mailers.rb 531 B

1234567891011121314
  1. # frozen_string_literal: true
  2. shared_examples 'localized subject' do |*args, **kwrest|
  3. it 'renders subject localized for the locale of the receiver' do
  4. locale = :de
  5. receiver.update!(locale: locale)
  6. expect(mail.subject).to eq I18n.t(*args, **kwrest.merge(locale: locale))
  7. end
  8. it 'renders subject localized for the default locale if the locale of the receiver is unavailable' do
  9. receiver.update!(locale: nil)
  10. expect(mail.subject).to eq I18n.t(*args, **kwrest.merge(locale: I18n.default_locale))
  11. end
  12. end