summaryrefslogtreecommitdiffstats
path: root/test/unit/watcher_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/watcher_test.rb')
-rw-r--r--test/unit/watcher_test.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb
index df49c7835..cd86988b4 100644
--- a/test/unit/watcher_test.rb
+++ b/test/unit/watcher_test.rb
@@ -140,7 +140,7 @@ class WatcherTest < ActiveSupport::TestCase
assert_equal 1, @issue.remove_watcher(@user)
end
- def test_prune
+ def test_prune_with_user
Watcher.delete_all("user_id = 9")
user = User.find(9)
@@ -172,6 +172,16 @@ class WatcherTest < ActiveSupport::TestCase
assert !Issue.find(4).watched_by?(user)
end
+ def test_prune_with_project
+ user = User.find(9)
+ Watcher.new(:watchable => Issue.find(4), :user => User.find(9)).save(:validate => false) # project 2
+ Watcher.new(:watchable => Issue.find(6), :user => User.find(9)).save(:validate => false) # project 5
+
+ assert Watcher.prune(:project => Project.find(5)) > 0
+ assert Issue.find(4).watched_by?(user)
+ assert !Issue.find(6).watched_by?(user)
+ end
+
def test_prune_all
user = User.find(9)
Watcher.new(:watchable => Issue.find(4), :user => User.find(9)).save(:validate => false)