about summary refs log tree commit diff
path: root/spec/controllers/concerns
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-23 17:21:55 +0200
committerGitHub <noreply@github.com>2019-07-23 17:21:55 +0200
commit08325db62bcc4d5d530513c615bc1c733f166239 (patch)
tree13cffcc0c8d6ed258928a89c1b328a055c54f2d3 /spec/controllers/concerns
parent6db5669818cce459b9bb916665541b7b8f5d5155 (diff)
parent48c68eafb73d2e697dab25ec55c235da4daf1cf8 (diff)
Merge pull request #1174 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/controllers/concerns')
-rw-r--r--spec/controllers/concerns/localized_spec.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/spec/controllers/concerns/localized_spec.rb b/spec/controllers/concerns/localized_spec.rb
index 76c3de118..7635d10e1 100644
--- a/spec/controllers/concerns/localized_spec.rb
+++ b/spec/controllers/concerns/localized_spec.rb
@@ -7,16 +7,10 @@ describe ApplicationController, type: :controller do
     include Localized
 
     def success
-      head 200
+      render plain: I18n.locale, status: 200
     end
   end
 
-  around do |example|
-    current_locale = I18n.locale
-    example.run
-    I18n.locale = current_locale
-  end
-
   before do
     routes.draw { get 'success' => 'anonymous#success' }
   end
@@ -25,19 +19,19 @@ describe ApplicationController, type: :controller do
     it 'sets available and preferred language' do
       request.headers['Accept-Language'] = 'ca-ES, fa'
       get 'success'
-      expect(I18n.locale).to eq :fa
+      expect(response.body).to eq 'fa'
     end
 
     it 'sets available and compatible language if none of available languages are preferred' do
       request.headers['Accept-Language'] = 'fa-IR'
       get 'success'
-      expect(I18n.locale).to eq :fa
+      expect(response.body).to eq 'fa'
     end
 
     it 'sets default locale if none of available languages are compatible' do
       request.headers['Accept-Language'] = ''
       get 'success'
-      expect(I18n.locale).to eq :en
+      expect(response.body).to eq 'en'
     end
   end
 
@@ -48,7 +42,7 @@ describe ApplicationController, type: :controller do
       sign_in(user)
       get 'success'
 
-      expect(I18n.locale).to eq :ca
+      expect(response.body).to eq 'ca'
     end
   end