@@ -140,7 +140,7 class WatcherTest < ActiveSupport::TestCase | |||
|
140 | 140 | assert_equal 1, @issue.remove_watcher(@user) |
|
141 | 141 | end |
|
142 | 142 | |
|
143 | def test_prune | |
|
143 | def test_prune_with_user | |
|
144 | 144 | Watcher.delete_all("user_id = 9") |
|
145 | 145 | user = User.find(9) |
|
146 | 146 | |
@@ -172,6 +172,16 class WatcherTest < ActiveSupport::TestCase | |||
|
172 | 172 | assert !Issue.find(4).watched_by?(user) |
|
173 | 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 | 185 | def test_prune_all |
|
176 | 186 | user = User.find(9) |
|
177 | 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