make users explicitly define localized setting values so it's clear which locale is mocked

pull/7249/head
Markus Kahl 6 years ago
parent e10f7c4d77
commit 3a5c68857e
  1. 6
      spec/support/shared/with_settings.rb
  2. 4
      spec_legacy/functional/user_mailer_spec.rb

@ -53,6 +53,12 @@ RSpec.configure do |config|
raise "#{k} is not a valid setting" unless Setting.respond_to?(name)
expect(name).not_to start_with("localized_"), ->() do
base = name[10..-1]
"Don't use `#{name}` in `with_settings`. Do this: `with_settings: { #{base}: { \"en\" => \"#{v}\" } }`"
end
allow(Setting).to receive(:[]).with(name).and_return v
allow(Setting).to receive(:[]).with(name.to_sym).and_return v
end

@ -396,7 +396,9 @@ describe UserMailer, type: :mailer do
context 'layout',
with_settings: {
available_languages: [:en, :de],
localized_emails_header: 'deutscher header'
emails_header: {
"de" => 'deutscher header'
}
} do
it 'should include the emails_header depeding on the locale' do
user = FactoryBot.create(:user, language: :de)

Loading…
Cancel
Save