Override watcher_user_ids= to make ids uniq (#10538).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9269 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-03-25 19:52:24 +00:00
parent 6115a079ec
commit 706f8b1691
2 changed files with 17 additions and 2 deletions
+7
View File
@@ -81,6 +81,13 @@ class WatcherTest < ActiveSupport::TestCase
assert issue.watched_by?(User.find(1))
end
def test_watcher_user_ids_should_make_ids_uniq
issue = Issue.new(:project => Project.find(1), :tracker_id => 1, :subject => "test", :author => User.find(2))
issue.watcher_user_ids = ['1', '3', '1']
issue.save!
assert_equal 2, issue.watchers.count
end
def test_addable_watcher_users
addable_watcher_users = @issue.addable_watcher_users
assert_kind_of Array, addable_watcher_users