From 02c814c99202e42ebeb10b89af1392b594c727e9 Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Thu, 19 Dec 2013 22:12:55 -0200 Subject: `html` and `text` templates for mailers by default --- railties/test/generators/mailer_generator_test.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'railties/test/generators') diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index 120ff3a2df..207628021a 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -63,7 +63,7 @@ class MailerGeneratorTest < Rails::Generators::TestCase Object.send :remove_const, :NotifierPreview end - def test_invokes_default_template_engine + def test_invokes_default_text_template_engine run_generator assert_file "app/views/notifier/foo.text.erb" do |view| assert_match(%r(app/views/notifier/foo\.text\.erb), view) @@ -76,6 +76,19 @@ class MailerGeneratorTest < Rails::Generators::TestCase end end + def test_invokes_default_html_template_engine + run_generator + assert_file "app/views/notifier/foo.html.erb" do |view| + assert_match(%r(app/views/notifier/foo\.html\.erb), view) + assert_match(/<%= @greeting %>/, view) + end + + assert_file "app/views/notifier/bar.html.erb" do |view| + assert_match(%r(app/views/notifier/bar\.html\.erb), view) + assert_match(/<%= @greeting %>/, view) + end + end + def test_invokes_default_template_engine_even_with_no_action run_generator ["notifier"] assert_file "app/views/notifier" @@ -96,6 +109,7 @@ class MailerGeneratorTest < Rails::Generators::TestCase assert_match(/class Farm::AnimalPreview < ActionMailer::Preview/, mailer) end assert_file "app/views/farm/animal/moos.text.erb" + assert_file "app/views/farm/animal/moos.html.erb" end def test_actions_are_turned_into_methods -- cgit v1.2.3