Commit a3409d2e authored by jplang's avatar jplang

Don't send notifications when using Issue.generate! in tests in order to speed up tests.

git-svn-id: https://svn.redmine.org/redmine/trunk@17680 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent aa86933a
......@@ -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!
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment