Welcome to mirror list, hosted at ThFree Co, Russian Federation.

i18n_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 52f2614d5cab6d08b5a2194142d7656a4c4be491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

module Gitlab
  describe 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)

        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)

        Gitlab::I18n.reset_locale

        expect(FastGettext.locale).to eq('en')
        expect(::I18n.locale).to eq(:en)
      end
    end
  end
end