diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-05-04 08:52:51 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-05-04 08:52:51 +0000 |
commit | 1269e6c7d3f5e067f4a77d78b66a8149255dd00a (patch) | |
tree | 5d8ef9fe1b13e7a0c9ac22784e743c20688361e5 /test/functional | |
parent | ed18b3359b6d4fc4b9a8d81c310a6bf8d01ef9ce (diff) | |
download | redmine-1269e6c7d3f5e067f4a77d78b66a8149255dd00a.tar.gz redmine-1269e6c7d3f5e067f4a77d78b66a8149255dd00a.zip |
Display the bulk edit form with error messages when some issues can not be saved (#13943).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11786 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/issues_controller_test.rb | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 59f7a858a..3e206db95 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -3588,13 +3588,32 @@ class IssuesControllerTest < ActionController::TestCase assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier end - def test_bulk_update_with_failure_should_set_flash + def test_bulk_update_with_all_failures_should_show_errors @request.session[:user_id] = 2 - Issue.update_all("subject = ''", "id = 2") # Make it invalid - post :bulk_update, :ids => [1, 2], :issue => {:priority_id => 6} + post :bulk_update, :ids => [1, 2], :issue => {:start_date => 'foo'} - assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook' - assert_equal 'Failed to save 1 issue(s) on 2 selected: #2.', flash[:error] + assert_response :success + assert_template 'bulk_edit' + assert_select '#errorExplanation span', :text => 'Failed to save 2 issue(s) on 2 selected: #1, #2.' + assert_select '#errorExplanation ul li', :text => 'Start date is not a valid date: #1, #2' + + assert_equal [1, 2], assigns[:issues].map(&:id) + end + + def test_bulk_update_with_some_failures_should_show_errors + issue1 = Issue.generate!(:start_date => '2013-05-12') + issue2 = Issue.generate!(:start_date => '2013-05-15') + issue3 = Issue.generate! + + @request.session[:user_id] = 2 + post :bulk_update, :ids => [issue1.id, issue2.id, issue3.id], :issue => {:due_date => '2013-05-01'} + + assert_response :success + assert_template 'bulk_edit' + assert_select '#errorExplanation span', :text => "Failed to save 2 issue(s) on 3 selected: ##{issue1.id}, ##{issue2.id}." + assert_select '#errorExplanation ul li', :text => "Due date must be greater than start date: ##{issue1.id}, ##{issue2.id}" + + assert_equal [issue1.id, issue2.id], assigns[:issues].map(&:id) end def test_get_bulk_copy |