debian-mirror-gitlab/spec/lib/gitlab/i18n_spec.rb
2020-08-09 17:44:08 +05:30

31 lines
745 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::I18n do
let(:user) { create(:user, preferred_language: 'es') }
describe '.locale=' do
after do
described_class.use_default_locale
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 '.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