diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-04 17:22:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-04 17:22:08 +0000 |
commit | 7b125bc2924125200e13bdbe5dc4c04e3078d157 (patch) | |
tree | 2721f982a3af27f2a074df2343a859a78cfcff9d /test | |
parent | 41cb7a3a55261c4497ea42510ab6753cac365409 (diff) | |
download | redmine-7b125bc2924125200e13bdbe5dc4c04e3078d157.tar.gz redmine-7b125bc2924125200e13bdbe5dc4c04e3078d157.zip |
Better handling of update failures when bulk editing time entries.
git-svn-id: http://svn.redmine.org/redmine/trunk@16477 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/timelog_controller_test.rb | 4 | ||||
-rw-r--r-- | test/ui/timelog_test_ui.rb | 30 |
2 files changed, 31 insertions, 3 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index ead919006..4e6df7e1b 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -582,8 +582,8 @@ class TimelogControllerTest < Redmine::ControllerTest @request.session[:user_id] = 2 post :bulk_update, :params => {:ids => [1, 2], :time_entry => { :hours => 'A'}} - assert_response 302 - assert_match /Failed to save 2 time entrie/, flash[:error] + assert_response :success + assert_select_error /Failed to save 2 time entrie/ end def test_bulk_update_on_different_projects diff --git a/test/ui/timelog_test_ui.rb b/test/ui/timelog_test_ui.rb index e0da8b067..0495b903e 100644 --- a/test/ui/timelog_test_ui.rb +++ b/test/ui/timelog_test_ui.rb @@ -20,7 +20,8 @@ require File.expand_path('../base', __FILE__) class Redmine::UiTest::TimelogTest < Redmine::UiTest::Base fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, :trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues, - :enumerations, :custom_fields, :custom_values, :custom_fields_trackers + :enumerations, :custom_fields, :custom_values, :custom_fields_trackers, + :time_entries def test_changing_project_should_update_activities project = Project.find(1) @@ -41,4 +42,31 @@ class Redmine::UiTest::TimelogTest < Redmine::UiTest::Base assert !has_content?('Design') end end + + def test_bulk_edit + log_user 'jsmith', 'jsmith' + visit '/time_entries/bulk_edit?ids[]=1&ids[]=2&ids[]=3' + fill_in 'Hours', :with => '8.5' + select 'QA', :from => 'Activity' + page.first(:button, 'Submit').click + + entries = TimeEntry.where(:id => [1,2,3]).to_a + assert entries.all? {|entry| entry.hours == 8.5} + assert entries.all? {|entry| entry.activity.name == 'QA'} + end + + def test_bulk_edit_with_failure + log_user 'jsmith', 'jsmith' + visit '/time_entries/bulk_edit?ids[]=1&ids[]=2&ids[]=3' + fill_in 'Hours', :with => 'A' + page.first(:button, 'Submit').click + + assert page.has_css?('#errorExplanation') + fill_in 'Hours', :with => '7' + page.first(:button, 'Submit').click + + assert_equal "/projects/ecookbook/time_entries", current_path + entries = TimeEntry.where(:id => [1,2,3]).to_a + assert entries.all? {|entry| entry.hours == 7.0} + end end |