summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-02-18 04:33:30 +0000
committerGo MAEDA <maeda@farend.jp>2018-02-18 04:33:30 +0000
commit5ed8c8e511ce61727b4c750c62b247d73cc3075c (patch)
tree8601e233641ee3c4dcdc6083c542d4e5dc1904e2 /test/functional
parent05dc4040c0504e9316ed7cd26f10cd7d4e39e68f (diff)
downloadredmine-5ed8c8e511ce61727b4c750c62b247d73cc3075c.tar.gz
redmine-5ed8c8e511ce61727b4c750c62b247d73cc3075c.zip
Merged r17199 from trunk to 3.4-stable (#28110).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17200 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/issues_controller_test.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 40055cb20..4adf06b31 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -6212,6 +6212,27 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_destroy_issues_with_time_entries_should_show_the_reassign_form
@request.session[:user_id] = 2
+ with_settings :timelog_required_fields => [] do
+ assert_no_difference 'Issue.count' do
+ delete :destroy, :params => {
+ :ids => [1, 3]
+ }
+ end
+ end
+ assert_response :success
+
+ assert_select 'form' do
+ assert_select 'input[name=_method][value=delete]'
+ assert_select 'input[name=todo][value=destroy]'
+ assert_select 'input[name=todo][value=nullify]'
+ assert_select 'input[name=todo][value=reassign]'
+ end
+ end
+
+ def test_destroy_issues_with_time_entries_should_not_show_the_nullify_option_when_issue_is_required_for_time_entries
+ with_settings :timelog_required_fields => ['issue_id'] do
+ @request.session[:user_id] = 2
+
assert_no_difference 'Issue.count' do
delete :destroy, :params => {
:ids => [1, 3]
@@ -6221,6 +6242,10 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'form' do
assert_select 'input[name=_method][value=delete]'
+ assert_select 'input[name=todo][value=destroy]'
+ assert_select 'input[name=todo][value=nullify]', 0
+ assert_select 'input[name=todo][value=reassign]'
+ end
end
end
@@ -6259,6 +6284,7 @@ class IssuesControllerTest < Redmine::ControllerTest
def test_destroy_issues_and_assign_time_entries_to_project
@request.session[:user_id] = 2
+ with_settings :timelog_required_fields => [] do
assert_difference 'Issue.count', -2 do
assert_no_difference 'TimeEntry.count' do
delete :destroy, :params => {
@@ -6267,6 +6293,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
end
end
+ end
assert_redirected_to :action => 'index', :project_id => 'ecookbook'
assert !(Issue.find_by_id(1) || Issue.find_by_id(3))
assert_nil TimeEntry.find(1).issue_id
@@ -6345,6 +6372,23 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select '#flash_error', :text => I18n.t(:error_cannot_reassign_time_entries_to_an_issue_about_to_be_deleted)
end
+ def test_destroy_issues_and_nullify_time_entries_should_fail_when_issue_is_required_for_time_entries
+ @request.session[:user_id] = 2
+
+ with_settings :timelog_required_fields => ['issue_id'] do
+ assert_no_difference 'Issue.count' do
+ assert_no_difference 'TimeEntry.count' do
+ delete :destroy, :params => {
+ :ids => [1, 3],
+ :todo => 'nullify'
+ }
+ end
+ end
+ end
+ assert_response :success
+ assert_select '#flash_error', :text => 'Issue cannot be blank'
+ end
+
def test_destroy_issues_from_different_projects
@request.session[:user_id] = 2