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