summaryrefslogtreecommitdiffstats
path: root/test/functional/issues_controller_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-05-19 00:44:10 +0000
committerGo MAEDA <maeda@farend.jp>2018-05-19 00:44:10 +0000
commit2943153ecaa463487b7f0e6bdcbdfe0e57aabab6 (patch)
treeefac7945c37e40ae6e1b0ac54eab810eb080c737 /test/functional/issues_controller_test.rb
parent7832ca683acead2491c8c7d1106c18a68e545ef0 (diff)
downloadredmine-2943153ecaa463487b7f0e6bdcbdfe0e57aabab6.tar.gz
redmine-2943153ecaa463487b7f0e6bdcbdfe0e57aabab6.zip
Fix: Copying an issue fails if the issue is watched by a locked user (#28765).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17342 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_test.rb')
-rw-r--r--test/functional/issues_controller_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index fc5b03576..99336f682 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -3916,6 +3916,29 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'input[type=hidden][name=?][value=?]', 'issue[watcher_user_ids][]', '', 1
end
+ def test_new_as_copy_should_not_propose_locked_watchers
+ @request.session[:user_id] = 2
+
+ issue = Issue.find(1)
+ user = User.generate!
+ user2 = User.generate!
+
+ Watcher.create!(:watchable => issue, :user => user)
+ Watcher.create!(:watchable => issue, :user => user2)
+
+ user2.status = User::STATUS_LOCKED
+ user2.save!
+ get :new, :params => {
+ :project_id => 1,
+ :copy_from => 1
+ }
+
+ assert_select 'input[type=checkbox][name=?][checked=checked]', 'issue[watcher_user_ids][]', 1
+ assert_select 'input[type=checkbox][name=?][checked=checked][value=?]', 'issue[watcher_user_ids][]', user.id.to_s
+ assert_select 'input[type=checkbox][name=?][checked=checked][value=?]', 'issue[watcher_user_ids][]', user2.id.to_s, 0
+ assert_select 'input[type=hidden][name=?][value=?]', 'issue[watcher_user_ids][]', '', 1
+ end
+
def test_new_as_copy_with_invalid_issue_should_respond_with_404
@request.session[:user_id] = 2
get :new, :params => {