diff options
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r-- | test/unit/issue_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 571b7ef3b..631f2614f 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -1498,6 +1498,8 @@ class IssueTest < ActiveSupport::TestCase user2 = User.find(3) issue = Issue.find(8) + User.current = user + Watcher.create!(:user => user, :watchable => issue) Watcher.create!(:user => user2, :watchable => issue) @@ -1511,6 +1513,24 @@ class IssueTest < ActiveSupport::TestCase assert !issue.watched_by?(user2) end + def test_copy_should_not_copy_watchers_without_permission + user = User.find(2) + user2 = User.find(3) + issue = Issue.find(8) + + Role.find(1).remove_permission! :view_issue_watchers + User.current = user + + Watcher.create!(:user => user, :watchable => issue) + Watcher.create!(:user => user2, :watchable => issue) + + issue = Issue.new.copy_from(8) + + assert issue.save + assert issue.watched_by?(user) + assert !issue.watched_by?(user2) + end + def test_copy_should_clear_subtasks_target_version_if_locked_or_closed version = Version.new(:project => Project.find(1), :name => '2.1') version.save! |