1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-11 13:15:20 +00:00

Adds a test for Watcher.prune with :project option.

git-svn-id: http://svn.redmine.org/redmine/trunk@13724 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-12-06 13:09:48 +00:00
parent e09f48e459
commit 43b3455111

View File

@ -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)