annotate .svn/pristine/cb/cb0276a6b1828c54ac9135df3c312c39f935b7fa.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 require File.dirname(__FILE__) + '/../test_helper'
Chris@909 2
Chris@909 3 class ActionMailerWithinApplicationTest < Test::Unit::TestCase
Chris@909 4
Chris@909 5 def test_normal_implicit_template
Chris@909 6 m = NotifyMail.create_signup("hello")
Chris@909 7 assert m.body =~ /^Signup template from application/
Chris@909 8 end
Chris@909 9
Chris@909 10 def test_action_mailer_can_get_helper
Chris@909 11 m = NotifyMail.create_signup('James')
Chris@909 12 assert m.body =~ /James/
Chris@909 13 assert m.body =~ /semaJ/ # from the helper
Chris@909 14 end
Chris@909 15
Chris@909 16 def test_multipart_mails_with_explicit_templates
Chris@909 17 m = NotifyMail.create_multipart
Chris@909 18 assert_equal 2, m.parts.length
Chris@909 19 assert_equal 'the html part of the email james', m.parts[0].body
Chris@909 20 assert_equal 'the plaintext part of the email', m.parts[1].body
Chris@909 21 end
Chris@909 22
Chris@909 23 def test_multipart_mails_with_implicit_templates
Chris@909 24 m = NotifyMail.create_implicit_multipart
Chris@909 25 assert_equal 2, m.parts.length
Chris@909 26 assert_equal 'the implicit plaintext part of the email', m.parts[0].body
Chris@909 27 assert_equal 'the implicit html part of the email james', m.parts[1].body
Chris@909 28 end
Chris@909 29 end
Chris@909 30
Chris@909 31
Chris@909 32 class ActionMailerWithinPluginsTest < Test::Unit::TestCase
Chris@909 33 def test_should_be_able_to_create_mails_from_plugin
Chris@909 34 m = PluginMail.create_mail_from_plugin("from_plugin")
Chris@909 35 assert_equal "from_plugin", m.body
Chris@909 36 end
Chris@909 37
Chris@909 38 def test_should_be_able_to_overload_views_within_the_application
Chris@909 39 m = PluginMail.create_mail_from_plugin_with_application_template("from_plugin")
Chris@909 40 assert_equal "from_plugin (from application)", m.body
Chris@909 41 end
Chris@909 42
Chris@909 43 def test_should_be_able_to_create_a_multipart_mail_from_within_plugin
Chris@909 44 m = PluginMail.create_multipart_from_plugin
Chris@909 45 assert_equal 2, m.parts.length
Chris@909 46 assert_equal 'html template', m.parts[0].body
Chris@909 47 assert_equal 'plain template', m.parts[1].body
Chris@909 48 end
Chris@909 49
Chris@909 50 def test_plugin_mailer_template_overriding
Chris@909 51 m = PluginMail.create_multipart_from_plugin_with_application_template
Chris@909 52 assert_equal 'plugin mail template loaded from application', m.parts[1].body
Chris@909 53 end
Chris@909 54 end