class ActionMailerI18nWithControllerTest

Constants

APP
Routes

Public Instance Methods

app() click to toggle source
# File actionmailer/test/i18n_with_controller_test.rb, line 50
def app
  APP
end
test_send_mail() click to toggle source
# File actionmailer/test/i18n_with_controller_test.rb, line 58
def test_send_mail
  stub_any_instance(Mail::SMTP, instance: Mail::SMTP.new({})) do |instance|
    assert_called(instance, :deliver!) do
      with_translation "de", email_subject: "[Anmeldung] Willkommen" do
        get "/test/send_mail"
        assert_equal "Mail sent - Subject: [Anmeldung] Willkommen", @response.body
      end
    end
  end
end

Private Instance Methods

with_translation(locale, data) { || ... } click to toggle source
# File actionmailer/test/i18n_with_controller_test.rb, line 71
def with_translation(locale, data)
  I18n.backend.store_translations(locale, data)
  yield
ensure
  I18n.backend.reload!
end