diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-04 20:47:29 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-01-04 20:47:29 +0000 |
commit | c4b1ab644ee60e18d0a62f3ab1ecb6aa57c1d731 (patch) | |
tree | 6ce9e42c502e0e76b39d2ff60b3a803a6655e47b /test/functional | |
parent | 82a67f4ebe5ac133bede65b7366d5ea31b05f8dc (diff) | |
download | redmine-c4b1ab644ee60e18d0a62f3ab1ecb6aa57c1d731.tar.gz redmine-c4b1ab644ee60e18d0a62f3ab1ecb6aa57c1d731.zip |
Merged r16118 to r16122 (#24693, #24718, #24722).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16132 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/issues_controller_test.rb | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 99b3ed04e..181bd86e3 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -4687,7 +4687,7 @@ class IssuesControllerTest < ActionController::TestCase assert_response :success end - def test_destroy_issue_with_no_time_entries + def test_destroy_issue_with_no_time_entries_should_delete_the_issues assert_nil TimeEntry.find_by_issue_id(2) @request.session[:user_id] = 2 @@ -4698,7 +4698,7 @@ class IssuesControllerTest < ActionController::TestCase assert_nil Issue.find_by_id(2) end - def test_destroy_issues_with_time_entries + def test_destroy_issues_with_time_entries_should_show_the_reassign_form @request.session[:user_id] = 2 assert_no_difference 'Issue.count' do @@ -4714,6 +4714,20 @@ class IssuesControllerTest < ActionController::TestCase end end + def test_destroy_issues_with_time_entries_should_show_hours_on_issues_and_descendants + parent = Issue.generate_with_child! + TimeEntry.generate!(:issue => parent) + TimeEntry.generate!(:issue => parent.children.first) + leaf = Issue.generate! + TimeEntry.generate!(:issue => leaf) + @request.session[:user_id] = 2 + + delete :destroy, :ids => [parent.id, leaf.id] + assert_response :success + + assert_select 'p', :text => /3\.00 hours were reported/ + end + def test_destroy_issues_and_destroy_time_entries @request.session[:user_id] = 2 @@ -4755,6 +4769,24 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 2, TimeEntry.find(2).issue_id end + def test_destroy_issues_with_time_entries_should_reassign_time_entries_of_issues_and_descendants + parent = Issue.generate_with_child! + TimeEntry.generate!(:issue => parent) + TimeEntry.generate!(:issue => parent.children.first) + leaf = Issue.generate! + TimeEntry.generate!(:issue => leaf) + target = Issue.generate! + @request.session[:user_id] = 2 + + assert_difference 'Issue.count', -3 do + assert_no_difference 'TimeEntry.count' do + delete :destroy, :ids => [parent.id, leaf.id], :todo => 'reassign', :reassign_to_id => target.id + assert_response 302 + end + end + assert_equal 3, target.time_entries.count + end + def test_destroy_issues_and_reassign_time_entries_to_an_invalid_issue_should_fail @request.session[:user_id] = 2 @@ -4768,6 +4800,18 @@ class IssuesControllerTest < ActionController::TestCase assert_template 'destroy' end + def test_destroy_issues_and_reassign_time_entries_to_an_issue_to_delete_should_fail + @request.session[:user_id] = 2 + + assert_no_difference 'Issue.count' do + assert_no_difference 'TimeEntry.count' do + delete :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 3 + end + end + assert_response :success + assert_select '#flash_error', :text => I18n.t(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted) + end + def test_destroy_issues_from_different_projects @request.session[:user_id] = 2 |