diff options
Diffstat (limited to 'actionmailer/test/i18n_with_controller_test.rb')
-rw-r--r-- | actionmailer/test/i18n_with_controller_test.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/actionmailer/test/i18n_with_controller_test.rb b/actionmailer/test/i18n_with_controller_test.rb index 50c4b74eb8..6e75cff347 100644 --- a/actionmailer/test/i18n_with_controller_test.rb +++ b/actionmailer/test/i18n_with_controller_test.rb @@ -1,10 +1,12 @@ -require 'abstract_unit' -require 'action_view' -require 'action_controller' +# frozen_string_literal: true + +require "abstract_unit" +require "action_view" +require "action_controller" class I18nTestMailer < ActionMailer::Base configure do |c| - c.assets_dir = '' + c.assets_dir = "" end def mail_with_i18n_subject(recipient) @@ -18,7 +20,7 @@ end class TestController < ActionController::Base def send_mail email = I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver_now - render text: "Mail sent - Subject: #{email.subject}" + render plain: "Mail sent - Subject: #{email.subject}" end end @@ -26,7 +28,7 @@ class ActionMailerI18nWithControllerTest < ActionDispatch::IntegrationTest Routes = ActionDispatch::Routing::RouteSet.new Routes.draw do ActiveSupport::Deprecation.silence do - get ':controller(/:action(/:id))' + get ":controller(/:action(/:id))" end end @@ -56,22 +58,20 @@ class ActionMailerI18nWithControllerTest < ActionDispatch::IntegrationTest 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 - ActiveSupport::Deprecation.silence do - get '/test/send_mail' - end + 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 - protected + private - def with_translation(locale, data) - I18n.backend.store_translations(locale, data) - yield - ensure - I18n.backend.reload! - end + def with_translation(locale, data) + I18n.backend.store_translations(locale, data) + yield + ensure + I18n.backend.reload! + end end |