summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-05-22 09:14:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-05-22 09:14:36 +0000
commit7e1f04bdfb6fd8860a3a5b552b5983be9d1f1b1f (patch)
tree6733a009c5c85dc7b766b99fc6e805e366e4d4de /test
parent5543ec5f5a4f55529c55f296fda69a09c30670ae (diff)
downloadredmine-7e1f04bdfb6fd8860a3a5b552b5983be9d1f1b1f.tar.gz
redmine-7e1f04bdfb6fd8860a3a5b552b5983be9d1f1b1f.zip
Do not propose users that can't view an issue as watchers (#7412).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5876 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/watcher_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb
index 86d96b2cb..d9abb7f6d 100644
--- a/test/unit/watcher_test.rb
+++ b/test/unit/watcher_test.rb
@@ -53,6 +53,17 @@ class WatcherTest < ActiveSupport::TestCase
assert issue.watched_by?(User.find(1))
end
+ def test_addable_watcher_users
+ addable_watcher_users = @issue.addable_watcher_users
+ assert_kind_of Array, addable_watcher_users
+ assert_kind_of User, addable_watcher_users.first
+ end
+
+ def test_addable_watcher_users_should_not_include_user_that_cannot_view_the_object
+ issue = Issue.new(:project => Project.find(1), :is_private => true)
+ assert_nil issue.addable_watcher_users.detect {|user| !issue.visible?(user)}
+ end
+
def test_recipients
@issue.watchers.delete_all
@issue.reload