From 3c423df203476429a3875f18d307992c3f9693bc Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 2 Dec 2018 08:36:14 +0000 Subject: [PATCH] Don't send notifications when using Issue.generate! in tests in order to speed up tests. git-svn-id: http://svn.redmine.org/redmine/trunk@17680 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/object_helpers.rb | 4 +++- test/unit/mailer_test.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/object_helpers.rb b/test/object_helpers.rb index b7d2eac93..8dd8df558 100644 --- a/test/object_helpers.rb +++ b/test/object_helpers.rb @@ -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! diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index da259beea..d61479202 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -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 ') + Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Subject with a ', :notify => true) mail = last_email assert_equal 2, mail.parts.size assert_include '', text_part.body.encoded -- 2.39.5