Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use with_translation helper to clean up I18n stored translations. #15083

Merged
merged 1 commit into from
May 13, 2014
Merged

Use with_translation helper to clean up I18n stored translations. #15083

merged 1 commit into from
May 13, 2014

Conversation

zuhao
Copy link
Contributor

@zuhao zuhao commented May 13, 2014

@senny please review. Thanks.

def test_send_mail
with_translation 'de', email_subject: '[Signed up] Welcome' do
get '/test/send_mail'
assert_equal "Mail sent", @response.body
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this test at least have an assertion about the translation?

@zuhao
Copy link
Contributor Author

zuhao commented May 13, 2014

@senny I've changed the test case slightly so that the translation is also tested. Is it okay?

I don't see why we need #{recipient} in the mail subject though, so I removed it.

@senny
Copy link
Member

senny commented May 13, 2014

Was #{recipient} interpolated?

@zuhao
Copy link
Contributor Author

zuhao commented May 13, 2014

@senny yes but why do we put recipient in the subject?

@senny
Copy link
Member

senny commented May 13, 2014

not sure... seems to be a static value. Should be fine to remove it.

@@ -10,15 +10,15 @@ class I18nTestMailer < ActionMailer::Base
def mail_with_i18n_subject(recipient)
@recipient = recipient
I18n.locale = :de
mail(to: recipient, subject: "#{I18n.t :email_subject} #{recipient}",
mail(to: recipient, subject: "#{I18n.t :email_subject}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of the String interpolation:

mail(to: recipient, subject: I18n.t(:email_subject),

@senny senny self-assigned this May 13, 2014
@zuhao
Copy link
Contributor Author

zuhao commented May 13, 2014

@senny done.

def setup
I18n.backend.store_translations('de', email_subject: '[Signed up] Welcome')
def test_send_mail
with_translation 'de', email_subject: '[Anmeldung] Wilkommen' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, Willkommen with double l

@zuhao
Copy link
Contributor Author

zuhao commented May 13, 2014

@senny right... Sorry for my absolute zero knowledge in German. 😄

@senny
Copy link
Member

senny commented May 13, 2014

😏

This is looking good 👍

senny added a commit that referenced this pull request May 13, 2014
…controller_test

Use with_translation helper to clean up I18n stored translations.
@senny senny merged commit fd6d6dc into rails:master May 13, 2014
@zuhao zuhao deleted the refactor_actionmailer_i18n_with_controller_test branch May 13, 2014 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants