summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index ae3fa5bda..5052f7a0c 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -249,4 +249,23 @@ class IssueTest < Test::Unit::TestCase
assert issue.save
assert_equal 1, ActionMailer::Base.deliveries.size
end
+
+ def test_stale_issue_should_not_send_email_notification
+ ActionMailer::Base.deliveries.clear
+ issue = Issue.find(1)
+ stale = Issue.find(1)
+
+ issue.init_journal(User.find(1))
+ issue.subject = 'Subjet update'
+ assert issue.save
+ assert_equal 1, ActionMailer::Base.deliveries.size
+ ActionMailer::Base.deliveries.clear
+
+ stale.init_journal(User.find(1))
+ stale.subject = 'Another subjet update'
+ assert_raise ActiveRecord::StaleObjectError do
+ stale.save
+ end
+ assert ActionMailer::Base.deliveries.empty?
+ end
end