diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-06-17 13:54:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-17 13:54:02 +0200 |
commit | 7eec279c7fb0350974fea4456c5c3bab7b457376 (patch) | |
tree | 5744c731973c3f0523f057cd6b96e75785c8de2d /spec | |
parent | 31e5d7efd700547d27d0393264859fa02932a8dd (diff) |
Change language opt-out to language opt-in (#7823)
* Switch filtered_languages to chosen_languages * Adjust interface * Remove unused translations
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/settings/preferences_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/status_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/spec/controllers/settings/preferences_controller_spec.rb b/spec/controllers/settings/preferences_controller_spec.rb index 7877c7362..f2028cf39 100644 --- a/spec/controllers/settings/preferences_controller_spec.rb +++ b/spec/controllers/settings/preferences_controller_spec.rb @@ -18,12 +18,12 @@ describe Settings::PreferencesController do describe 'PUT #update' do it 'updates the user record' do - put :update, params: { user: { locale: 'en', filtered_languages: ['es', 'fr', ''] } } + put :update, params: { user: { locale: 'en', chosen_languages: ['es', 'fr', ''] } } expect(response).to redirect_to(settings_preferences_path) user.reload expect(user.locale).to eq 'en' - expect(user.filtered_languages).to eq ['es', 'fr'] + expect(user.chosen_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 5113b652f..b3e475d99 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -259,18 +259,18 @@ RSpec.describe Status, type: :model do end end - describe '.not_in_filtered_languages' do + describe '.in_chosen_languages' do context 'for accounts with language filters' do - let(:user) { Fabricate(:user, filtered_languages: ['en']) } + let(:user) { Fabricate(:user, chosen_languages: ['en']) } - it 'does not include statuses in filtered languages' do - status = Fabricate(:status, language: 'en') - expect(Status.not_in_filtered_languages(user.account)).not_to include status + it 'does not include statuses in not in chosen languages' do + status = Fabricate(:status, language: 'de') + expect(Status.in_chosen_languages(user.account)).not_to include status end it 'includes status with unknown language' do status = Fabricate(:status, language: nil) - expect(Status.not_in_filtered_languages(user.account)).to include status + expect(Status.in_chosen_languages(user.account)).to include status end end end @@ -518,7 +518,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, filtered_languages: [:fr]) + user = Fabricate(:user, chosen_languages: [:en, :es]) @account.update(user: user) en_status = Fabricate(:status, language: 'en') es_status = Fabricate(:status, language: 'es') @@ -531,7 +531,7 @@ RSpec.describe Status, type: :model do end it 'includes all languages when user does not have a setting' do - user = Fabricate(:user, filtered_languages: []) + user = Fabricate(:user, chosen_languages: nil) @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 cc8d88cc8..93a6c26fb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -41,9 +41,9 @@ RSpec.describe User, type: :model do end it 'cleans out empty string from languages' do - user = Fabricate.build(:user, filtered_languages: ['']) + user = Fabricate.build(:user, chosen_languages: ['']) user.valid? - expect(user.filtered_languages).to eq [] + expect(user.chosen_languages).to eq nil end end |