@ -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
@ -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)