about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-05-20 11:32:44 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-05-20 17:32:44 +0200
commit8f4b7c1820b046c8df10e043a0bc605f3007eee7 (patch)
treecd8703410d9c374f89e4845600aad931f04bd6a9 /spec
parent2e112e240666b62b8c3d4fa201fb24b841f6c92b (diff)
Filter languages with opt out (#3175)
* Remove allowed_languages and add filtered_languages

* Use filtered_languages instead of allowed_languages
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/settings/preferences_controller_spec.rb6
-rw-r--r--spec/models/status_spec.rb4
-rw-r--r--spec/models/user_spec.rb4
3 files changed, 7 insertions, 7 deletions
diff --git a/spec/controllers/settings/preferences_controller_spec.rb b/spec/controllers/settings/preferences_controller_spec.rb
index 6805a2ce0..38e43f211 100644
--- a/spec/controllers/settings/preferences_controller_spec.rb
+++ b/spec/controllers/settings/preferences_controller_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
 describe Settings::PreferencesController do
   render_views
 
-  let(:user) { Fabricate(:user, allowed_languages: []) }
+  let(:user) { Fabricate(:user, filtered_languages: []) }
 
   before do
     sign_in user, scope: :user
@@ -18,12 +18,12 @@ describe Settings::PreferencesController do
 
   describe 'PUT #update' do
     it 'updates the user record' do
-      put :update, params: { user: { locale: 'en', allowed_languages: ['es', 'fr', ''] } }
+      put :update, params: { user: { locale: 'en', filtered_languages: ['es', 'fr', ''] } }
 
       expect(response).to redirect_to(settings_preferences_path)
       user.reload
       expect(user.locale).to eq 'en'
-      expect(user.allowed_languages).to eq ['es', 'fr']
+      expect(user.filtered_languages).to eq ['es', 'fr']
     end
 
     it 'updates user settings' do
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index e9e55a92b..d3a66134b 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -512,7 +512,7 @@ RSpec.describe Status, type: :model do
 
       context 'with language preferences' do
         it 'excludes statuses in languages not allowed by the account user' do
-          user = Fabricate(:user, allowed_languages: [:en, :es])
+          user = Fabricate(:user, filtered_languages: [:fr])
           @account.update(user: user)
           en_status = Fabricate(:status, language: 'en')
           es_status = Fabricate(:status, language: 'es')
@@ -525,7 +525,7 @@ RSpec.describe Status, type: :model do
         end
 
         it 'includes all languages when user does not have a setting' do
-          user = Fabricate(:user, allowed_languages: [])
+          user = Fabricate(:user, filtered_languages: [])
           @account.update(user: user)
 
           en_status = Fabricate(:status, language: 'en')
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 04c39de3b..c3e924fd8 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -24,9 +24,9 @@ RSpec.describe User, type: :model do
     end
 
     it 'cleans out empty string from languages' do
-      user = Fabricate.build(:user, allowed_languages: [''])
+      user = Fabricate.build(:user, filtered_languages: [''])
       user.valid?
-      expect(user.allowed_languages).to eq []
+      expect(user.filtered_languages).to eq []
     end
   end