summaryrefslogtreecommitdiffstats
path: root/test/unit/watcher_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-06 13:09:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-06 13:09:48 +0000
commit43b3455111391b1b578b3319fd02001c08783830 (patch)
treed9fa23798252ae88a7370c968ea02e372aecaefa /test/unit/watcher_test.rb
parente09f48e45994ef342f53f965c829d591be711bcf (diff)
downloadredmine-43b3455111391b1b578b3319fd02001c08783830.tar.gz
redmine-43b3455111391b1b578b3319fd02001c08783830.zip
Adds a test for Watcher.prune with :project option.
git-svn-id: http://svn.redmine.org/redmine/trunk@13724 e93f8b46-1217-0410-a6f0-8f06a7374b81
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)