0
0
Fork 0

Move localized subject mailer shared example to separate file (#25889)

This commit is contained in:
Matt Jankowski 2023-07-20 09:50:50 -04:00 committed by GitHub
parent cabe1ea560
commit 285a3df56c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 26 deletions

View file

@ -5,19 +5,6 @@ require 'rails_helper'
describe UserMailer do
let(:receiver) { Fabricate(:user) }
shared_examples 'localized subject' do |*args, **kwrest|
it 'renders subject localized for the locale of the receiver' do
locale = :de
receiver.update!(locale: locale)
expect(mail.subject).to eq I18n.t(*args, **kwrest.merge(locale: locale))
end
it 'renders subject localized for the default locale if the locale of the receiver is unavailable' do
receiver.update!(locale: nil)
expect(mail.subject).to eq I18n.t(*args, **kwrest.merge(locale: I18n.default_locale))
end
end
describe 'confirmation_instructions' do
let(:mail) { described_class.confirmation_instructions(receiver, 'spec') }