summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-04-06 17:34:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-04-06 17:34:45 +0000
commit1cd985dd6b2a674b632be0d490f6f5070e35591d (patch)
tree7c8ac28f617888b721154df5e3a8876bc4a2b7e2 /test
parent8ea86a8249463e3d848e0490228da63b40d2d0bb (diff)
downloadredmine-1cd985dd6b2a674b632be0d490f6f5070e35591d.tar.gz
redmine-1cd985dd6b2a674b632be0d490f6f5070e35591d.zip
Option to copy watchers when copying issues (#10460).
git-svn-id: http://svn.redmine.org/redmine/trunk@16509 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 6c025123d..dacbd370e 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -3065,6 +3065,16 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'input[type=checkbox][name=copy_subtasks][checked=checked][value="1"]'
end
+ def test_new_as_copy_should_preserve_watchers
+ @request.session[:user_id] = 2
+ user = User.generate!
+ Watcher.create!(:watchable => Issue.find(1), :user => user)
+ get :new, :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
+ end
+
def test_new_as_copy_with_invalid_issue_should_respond_with_404
@request.session[:user_id] = 2
get :new, :project_id => 1, :copy_from => 99999
@@ -4725,6 +4735,20 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_equal count, copy.descendants.count
end
+ def test_bulk_copy_should_allow_copying_the_subtasks
+ Watcher.create!(:watchable => Issue.find(1), :user => User.find(3))
+ @request.session[:user_id] = 2
+
+ assert_difference 'Issue.count' do
+ post :bulk_update, :ids => [1], :copy => '1', :copy_watchers => '1',
+ :issue => {
+ :project_id => ''
+ }
+ end
+ copy = Issue.order(:id => :desc).first
+ assert_equal 1, copy.watchers.count
+ end
+
def test_bulk_copy_should_not_copy_selected_subtasks_twice
issue = Issue.generate_with_descendants!
count = issue.descendants.count