aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorKassio Borges <kassioborgesm@gmail.com>2013-12-19 22:12:55 -0200
committerKassio Borges <kassioborgesm@gmail.com>2013-12-20 18:34:57 -0200
commit02c814c99202e42ebeb10b89af1392b594c727e9 (patch)
treef2c479e4e65c8ba26c66616af123c357edee4766 /railties/test/generators
parentd0ffa7f8535dc343bb8a421520ea32d8e8be916f (diff)
downloadrails-02c814c99202e42ebeb10b89af1392b594c727e9.tar.gz
rails-02c814c99202e42ebeb10b89af1392b594c727e9.tar.bz2
rails-02c814c99202e42ebeb10b89af1392b594c727e9.zip
`html` and `text` templates for mailers by default
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/mailer_generator_test.rb16
1 files changed, 15 insertions, 1 deletions
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