##// END OF EJS Templates
Adds a test for Watcher.prune with :project option....
Jean-Philippe Lang -
r13342:43b345511139
parent child
Show More
@@ -140,7 +140,7 class WatcherTest < ActiveSupport::TestCase
140 assert_equal 1, @issue.remove_watcher(@user)
140 assert_equal 1, @issue.remove_watcher(@user)
141 end
141 end
142
142
143 def test_prune
143 def test_prune_with_user
144 Watcher.delete_all("user_id = 9")
144 Watcher.delete_all("user_id = 9")
145 user = User.find(9)
145 user = User.find(9)
146
146
@@ -172,6 +172,16 class WatcherTest < ActiveSupport::TestCase
172 assert !Issue.find(4).watched_by?(user)
172 assert !Issue.find(4).watched_by?(user)
173 end
173 end
174
174
175 def test_prune_with_project
176 user = User.find(9)
177 Watcher.new(:watchable => Issue.find(4), :user => User.find(9)).save(:validate => false) # project 2
178 Watcher.new(:watchable => Issue.find(6), :user => User.find(9)).save(:validate => false) # project 5
179
180 assert Watcher.prune(:project => Project.find(5)) > 0
181 assert Issue.find(4).watched_by?(user)
182 assert !Issue.find(6).watched_by?(user)
183 end
184
175 def test_prune_all
185 def test_prune_all
176 user = User.find(9)
186 user = User.find(9)
177 Watcher.new(:watchable => Issue.find(4), :user => User.find(9)).save(:validate => false)
187 Watcher.new(:watchable => Issue.find(4), :user => User.find(9)).save(:validate => false)
General Comments 0
You need to be logged in to leave comments. Login now