diff options
Diffstat (limited to 'railties/test/generators/mailer_generator_test.rb')
-rw-r--r-- | railties/test/generators/mailer_generator_test.rb | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index bf1cfe5305..139d6b1421 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -9,11 +9,11 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_mailer_skeleton_is_created run_generator assert_file "app/mailers/notifier.rb" do |mailer| - assert_match /class Notifier < ActionMailer::Base/, mailer + assert_match(/class Notifier < ActionMailer::Base/, mailer) if RUBY_VERSION < "1.9" - assert_match /default :from => "from@example.com"/, mailer + assert_match(/default :from => "from@example.com"/, mailer) else - assert_match /default from: "from@example.com"/, mailer + assert_match(/default from: "from@example.com"/, mailer) end end end @@ -21,35 +21,35 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_mailer_with_i18n_helper run_generator assert_file "app/mailers/notifier.rb" do |mailer| - assert_match /en\.notifier\.foo\.subject/, mailer - assert_match /en\.notifier\.bar\.subject/, mailer + assert_match(/en\.notifier\.foo\.subject/, mailer) + assert_match(/en\.notifier\.bar\.subject/, mailer) end end def test_check_class_collision content = capture(:stderr){ run_generator ["object"] } - assert_match /The name 'Object' is either already used in your application or reserved/, content + assert_match(/The name 'Object' is either already used in your application or reserved/, content) end def test_invokes_default_test_framework run_generator assert_file "test/functional/notifier_test.rb" do |test| - assert_match /class NotifierTest < ActionMailer::TestCase/, test - assert_match /test "foo"/, test - assert_match /test "bar"/, test + assert_match(/class NotifierTest < ActionMailer::TestCase/, test) + assert_match(/test "foo"/, test) + assert_match(/test "bar"/, test) end end def test_invokes_default_template_engine run_generator assert_file "app/views/notifier/foo.text.erb" do |view| - assert_match %r(app/views/notifier/foo\.text\.erb), view - assert_match /<%= @greeting %>/, view + assert_match(%r(app/views/notifier/foo\.text\.erb), view) + assert_match(/<%= @greeting %>/, view) end assert_file "app/views/notifier/bar.text.erb" do |view| - assert_match %r(app/views/notifier/bar\.text\.erb), view - assert_match /<%= @greeting %>/, view + assert_match(%r(app/views/notifier/bar\.text\.erb), view) + assert_match(/<%= @greeting %>/, view) end end @@ -60,14 +60,14 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_logs_if_the_template_engine_cannot_be_found content = run_generator ["notifier", "foo", "bar", "--template-engine=haml"] - assert_match /haml \[not found\]/, content + assert_match(/haml \[not found\]/, content) end def test_mailer_with_namedspaced_mailer run_generator ["Farm::Animal", "moos"] assert_file "app/mailers/farm/animal.rb" do |mailer| - assert_match /class Farm::Animal < ActionMailer::Base/, mailer - assert_match /en\.farm\.animal\.moos\.subject/, mailer + assert_match(/class Farm::Animal < ActionMailer::Base/, mailer) + assert_match(/en\.farm\.animal\.moos\.subject/, mailer) end assert_file "app/views/farm/animal/moos.text.erb" end @@ -78,20 +78,20 @@ class MailerGeneratorTest < Rails::Generators::TestCase assert_file "app/mailers/notifier.rb" do |mailer| assert_instance_method :foo, mailer do |foo| if RUBY_VERSION < "1.9" - assert_match /mail :to => "to@example.org"/, foo + assert_match(/mail :to => "to@example.org"/, foo) else - assert_match /mail to: "to@example.org"/, foo + assert_match(/mail to: "to@example.org"/, foo) end - assert_match /@greeting = "Hi"/, foo + assert_match(/@greeting = "Hi"/, foo) end assert_instance_method :bar, mailer do |bar| if RUBY_VERSION < "1.9" - assert_match /mail :to => "to@example.org"/, bar + assert_match(/mail :to => "to@example.org"/, bar) else - assert_match /mail to: "to@example.org"/, bar + assert_match(/mail to: "to@example.org"/, bar) end - assert_match /@greeting = "Hi"/, bar + assert_match(/@greeting = "Hi"/, bar) end end end @@ -99,10 +99,10 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_force_old_style_hash run_generator ["notifier", "foo", "--old-style-hash"] assert_file "app/mailers/notifier.rb" do |mailer| - assert_match /default :from => "from@example.com"/, mailer + assert_match(/default :from => "from@example.com"/, mailer) assert_instance_method :foo, mailer do |foo| - assert_match /mail :to => "to@example.org"/, foo + assert_match(/mail :to => "to@example.org"/, foo) end end end |