1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-19 10:02:04 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2018-12-02 08:36:14 +00:00
parent 0e9837e4d1
commit 3c423df203
2 changed files with 4 additions and 2 deletions

View 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!

View 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