class NamespacedMailerGeneratorTest

Public Instance Methods

test_invokes_default_template_engine() click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 177
def test_invokes_default_template_engine
  run_generator
  assert_file "app/views/test_app/notifier_mailer/foo.text.erb" do |view|
    assert_match(%r(app/views/test_app/notifier_mailer/foo\.text\.erb), view)
    assert_match(/<%= @greeting %>/, view)
  end

  assert_file "app/views/test_app/notifier_mailer/bar.text.erb" do |view|
    assert_match(%r(app/views/test_app/notifier_mailer/bar\.text\.erb), view)
    assert_match(/<%= @greeting %>/, view)
  end
end
test_invokes_default_template_engine_even_with_no_action() click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 190
def test_invokes_default_template_engine_even_with_no_action
  run_generator ["notifier"]
  assert_file "app/views/test_app/notifier_mailer"
end
test_invokes_default_test_framework() click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 167
def test_invokes_default_test_framework
  run_generator
  assert_file "test/mailers/test_app/notifier_mailer_test.rb" do |test|
    assert_match(/module TestApp/, test)
    assert_match(/class NotifierMailerTest < ActionMailer::TestCase/, test)
    assert_match(/test "foo"/, test)
    assert_match(/test "bar"/, test)
  end
end
test_mailer_skeleton_is_created() click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 150
def test_mailer_skeleton_is_created
  run_generator
  assert_file "app/mailers/test_app/notifier_mailer.rb" do |mailer|
    assert_match(/module TestApp/, mailer)
    assert_match(/class NotifierMailer < ApplicationMailer/, mailer)
    assert_no_match(/default from: "from@example.com"/, mailer)
  end
end
test_mailer_with_i18n_helper() click to toggle source
# File railties/test/generators/namespaced_generators_test.rb, line 159
def test_mailer_with_i18n_helper
  run_generator
  assert_file "app/mailers/test_app/notifier_mailer.rb" do |mailer|
    assert_match(/en\.notifier_mailer\.foo\.subject/, mailer)
    assert_match(/en\.notifier_mailer\.bar\.subject/, mailer)
  end
end