diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-11 18:25:05 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-11 18:25:05 +0000 |
commit | e0c7eb25a42e6b052c90b32014ef7dc96560f47f (patch) | |
tree | ff59fc0416667bed244d00569ebb48390a2dfceb /test/unit/watcher_test.rb | |
parent | 2113b88db34bef9ef4af18e766f2a882505ee789 (diff) | |
download | redmine-e0c7eb25a42e6b052c90b32014ef7dc96560f47f.tar.gz redmine-e0c7eb25a42e6b052c90b32014ef7dc96560f47f.zip |
Adds Watcher.any_watched? to check if at least one object of a collection is watched.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11959 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/watcher_test.rb')
-rw-r--r-- | test/unit/watcher_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb index 6719ee8a6..fb1163aae 100644 --- a/test/unit/watcher_test.rb +++ b/test/unit/watcher_test.rb @@ -99,6 +99,23 @@ class WatcherTest < ActiveSupport::TestCase assert_nil issue.addable_watcher_users.detect {|user| !issue.visible?(user)} end + def test_any_watched_should_return_false_if_no_object_is_watched + objects = (0..2).map {Issue.generate!} + + assert_equal false, Watcher.any_watched?(objects, @user) + end + + def test_any_watched_should_return_true_if_one_object_is_watched + objects = (0..2).map {Issue.generate!} + objects.last.add_watcher(@user) + + assert_equal true, Watcher.any_watched?(objects, @user) + end + + def test_any_watched_should_return_false_with_no_object + assert_equal false, Watcher.any_watched?([], @user) + end + def test_recipients @issue.watchers.delete_all @issue.reload |