Fix tests for latest locale change

This commit is contained in:
Sebastian Serth
2022-07-15 14:02:10 +02:00
parent baf70a0c06
commit c792b99523
2 changed files with 4 additions and 4 deletions

View File

@ -43,14 +43,14 @@ describe ApplicationController do
context "when using the 'custom_locale' parameter" do
it 'overwrites the session' do
expect(session).to receive(:[]=).with(:locale, locale.to_s)
expect(session).to receive(:[]=).with(:locale, locale)
get :welcome, params: {custom_locale: locale}
end
end
context "when using the 'locale' parameter" do
it 'overwrites the session' do
expect(session).to receive(:[]=).with(:locale, locale.to_s)
expect(session).to receive(:[]=).with(:locale, locale)
get :welcome, params: {locale: locale}
end
end

View File

@ -86,9 +86,9 @@ describe SessionsController do
it 'sets the specified locale' do
expect(controller).to receive(:switch_locale).and_call_original
i18n = class_double I18n, locale: locale.to_s
i18n = class_double I18n, locale: locale
allow(I18n).to receive(:locale=).with(I18n.default_locale).and_call_original
allow(I18n).to receive(:locale=).with(locale.to_s).and_return(i18n)
allow(I18n).to receive(:locale=).with(locale).and_return(i18n)
perform_request
expect(i18n.locale.to_sym).to eq(locale)
end