summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-09 03:15:32 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-07-09 03:15:32 +0000
commitf416657d563562af639025924834f2960aa54412 (patch)
tree15955e5f0e805d41c1277f15863e2f36875f3f9c /test/unit
parent4c78b63d58b7f7fd71b34d88c0aea6dc1fdf76ad (diff)
downloadredmine-f416657d563562af639025924834f2960aa54412.tar.gz
redmine-f416657d563562af639025924834f2960aa54412.zip
When creating issues by receiving an email, watchers created via CC in the mail don't get an email notification (#23278).
git-svn-id: http://svn.redmine.org/redmine/trunk@15609 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/mail_handler_test.rb5
-rw-r--r--test/unit/watcher_test.rb9
2 files changed, 12 insertions, 2 deletions
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 07d579a5d..c1afdaebd 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -277,12 +277,13 @@ class MailHandlerTest < ActiveSupport::TestCase
end
def test_add_issue_should_add_cc_as_watchers
+ user = User.find_by_mail('dlopper@somenet.foo')
issue = submit_email('ticket_with_cc.eml', :issue => {:project => 'ecookbook'})
assert issue.is_a?(Issue)
assert !issue.new_record?
- issue.reload
- assert issue.watched_by?(User.find_by_mail('dlopper@somenet.foo'))
+ assert issue.watched_by?(user)
assert_equal 1, issue.watcher_user_ids.size
+ assert_include user, issue.watcher_users.to_a
end
def test_add_issue_from_additional_email_address
diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb
index f4d91794d..8ffca148a 100644
--- a/test/unit/watcher_test.rb
+++ b/test/unit/watcher_test.rb
@@ -60,6 +60,15 @@ class WatcherTest < ActiveSupport::TestCase
assert_kind_of User, watcher_users.first
end
+ def test_watcher_users_should_be_reloaded_after_adding_a_watcher
+ issue = Issue.find(2)
+ user = User.generate!
+
+ assert_difference 'issue.watcher_users.to_a.size' do
+ issue.add_watcher user
+ end
+ end
+
def test_watcher_users_should_not_validate_user
User.where(:id => 1).update_all("firstname = ''")
@user.reload