diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-05-22 10:30:26 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-05-22 10:30:26 +0000 |
commit | ef00501c36992221a1afa5f5bd4706ed91fbb7f1 (patch) | |
tree | 81baa55ee9cfc1283e6fe685be386c255bd88baa /test/unit/watcher_test.rb | |
parent | 1b4a5e5aff16d42ff330ff23abd39e197398959a (diff) | |
download | redmine-ef00501c36992221a1afa5f5bd4706ed91fbb7f1.tar.gz redmine-ef00501c36992221a1afa5f5bd4706ed91fbb7f1.zip |
Fixed: validation error on issue creation when trying to add an invalid user as a watcher (#5373).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5880 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/watcher_test.rb')
-rw-r--r-- | test/unit/watcher_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb index d9abb7f6d..b9ef579d3 100644 --- a/test/unit/watcher_test.rb +++ b/test/unit/watcher_test.rb @@ -47,7 +47,28 @@ class WatcherTest < ActiveSupport::TestCase assert Issue.watched_by(@user).include?(@issue) end + def test_watcher_users + watcher_users = Issue.find(2).watcher_users + assert_kind_of Array, watcher_users + assert_kind_of User, watcher_users.first + end + + def test_watcher_users_should_not_validate_user + User.update_all("firstname = ''", "id=1") + @user.reload + assert !@user.valid? + + issue = Issue.new(:project => Project.find(1), :tracker_id => 1, :subject => "test", :author => User.find(2)) + issue.watcher_users << @user + issue.save! + assert issue.watched_by?(@user) + end + def test_watcher_user_ids + assert_equal [1, 3], Issue.find(2).watcher_user_ids.sort + end + + def test_watcher_user_ids= issue = Issue.new issue.watcher_user_ids = ['1', '3'] assert issue.watched_by?(User.find(1)) |