]> source.dussan.org Git - redmine.git/commitdiff
Don't send notifications when using Issue.generate! in tests in order to speed up...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Dec 2018 08:36:14 +0000 (08:36 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 2 Dec 2018 08:36:14 +0000 (08:36 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@17680 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/object_helpers.rb
test/unit/mailer_test.rb

index b7d2eac93ad4cf01677cc417a803b04e067f5f5c..8dd8df558d0cab5f4f08832e3cf884d63aa5375b 100644 (file)
@@ -87,8 +87,9 @@ module ObjectHelpers
   end
 
   # Generates an unsaved Issue
+  # Doesn't send notifications by default, use :notify => true to send them
   def Issue.generate(attributes={})
-    issue = Issue.new(attributes)
+    issue = Issue.new(attributes.reverse_merge(:notify => false))
     issue.project ||= Project.find(1)
     issue.tracker ||= issue.project.trackers.first
     issue.subject = 'Generated' if issue.subject.blank?
@@ -98,6 +99,7 @@ module ObjectHelpers
   end
 
   # Generates a saved Issue
+  # Doesn't send notifications by default, use :notify => true to send them
   def Issue.generate!(attributes={}, &block)
     issue = Issue.generate(attributes, &block)
     issue.save!
index da259beead50019b3ea9e0f1bba2f133719493a3..d61479202d2874c17b3338ece852aea8c5577a87 100644 (file)
@@ -791,7 +791,7 @@ class MailerTest < ActiveSupport::TestCase
   end
 
   def test_should_escape_html_templates_only
-    Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Subject with a <tag>')
+    Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Subject with a <tag>', :notify => true)
     mail = last_email
     assert_equal 2, mail.parts.size
     assert_include '<tag>', text_part.body.encoded