diff options
author | Ruben Davila <rdavila84@gmail.com> | 2017-05-25 18:22:45 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2017-05-25 18:22:45 +0300 |
commit | 5c921809cd86e1031a6a5075da142fef3bb01d6d (patch) | |
tree | 0c04cf9d24f9e94c2bf5dfd709c22f142bec5e77 /spec/lib/gitlab/i18n_spec.rb | |
parent | d07e85e1033f8026f155c6171cb3ebcd6b93d9ed (diff) |
Bugfix: Always use the default language when generating emails.
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.
Diffstat (limited to 'spec/lib/gitlab/i18n_spec.rb')
-rw-r--r-- | spec/lib/gitlab/i18n_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/lib/gitlab/i18n_spec.rb b/spec/lib/gitlab/i18n_spec.rb index 52f2614d5ca..a3dbeaa3753 100644 --- a/spec/lib/gitlab/i18n_spec.rb +++ b/spec/lib/gitlab/i18n_spec.rb @@ -1,27 +1,27 @@ require 'spec_helper' -module Gitlab - describe I18n, lib: true do - let(:user) { create(:user, preferred_language: 'es') } +describe Gitlab::I18n, lib: true do + let(:user) { create(:user, preferred_language: 'es') } - describe '.set_locale' do - it 'sets the locale based on current user preferred language' do - Gitlab::I18n.set_locale(user) + describe '.locale=' do + after { described_class.use_default_locale } - expect(FastGettext.locale).to eq('es') - expect(::I18n.locale).to eq(:es) - end + 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 '.reset_locale' do - it 'resets the locale to the default language' do - Gitlab::I18n.set_locale(user) + describe '.use_default_locale' do + it 'resets the locale to the default language' do + described_class.locale = user.preferred_language - Gitlab::I18n.reset_locale + described_class.use_default_locale - expect(FastGettext.locale).to eq('en') - expect(::I18n.locale).to eq(:en) - end + expect(FastGettext.locale).to eq('en') + expect(::I18n.locale).to eq(:en) end end end |