5c921809cd
There was a race condition issue when the application was generating an email and was using a language that was previously being used in other request.
27 lines
706 B
Ruby
27 lines
706 B
Ruby
require 'spec_helper'
|
|
|
|
describe Gitlab::I18n, lib: true do
|
|
let(:user) { create(:user, preferred_language: 'es') }
|
|
|
|
describe '.locale=' do
|
|
after { described_class.use_default_locale }
|
|
|
|
it 'sets the locale based on current user preferred language' do
|
|
described_class.locale = user.preferred_language
|
|
|
|
expect(FastGettext.locale).to eq('es')
|
|
expect(::I18n.locale).to eq(:es)
|
|
end
|
|
end
|
|
|
|
describe '.use_default_locale' do
|
|
it 'resets the locale to the default language' do
|
|
described_class.locale = user.preferred_language
|
|
|
|
described_class.use_default_locale
|
|
|
|
expect(FastGettext.locale).to eq('en')
|
|
expect(::I18n.locale).to eq(:en)
|
|
end
|
|
end
|
|
end
|