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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Davila <rdavila84@gmail.com>2017-05-05 02:44:19 +0300
committerRuben Davila <rdavila84@gmail.com>2017-05-05 02:44:19 +0300
commitb396668ec55fb866ef578e5f0e60df8b13519613 (patch)
tree30c6fc7a82dec48c4f4bc38a768ada1caaac1b5e /spec/lib/gitlab/i18n_spec.rb
parentf7b7a520920204d1a2864af6d911ef9dc8c2df6b (diff)
Add CHANGELOG entry, some specs and locale file for German.
Diffstat (limited to 'spec/lib/gitlab/i18n_spec.rb')
-rw-r--r--spec/lib/gitlab/i18n_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/i18n_spec.rb b/spec/lib/gitlab/i18n_spec.rb
new file mode 100644
index 00000000000..52f2614d5ca
--- /dev/null
+++ b/spec/lib/gitlab/i18n_spec.rb
@@ -0,0 +1,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