diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-08-01 14:54:56 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-08-01 14:54:56 +0000 |
commit | 4c77c30fbfb3734fd893f7cfe540fa595ea6539c (patch) | |
tree | ac0572310bfce7bc9860f8122fe36ee09a18526c /spec | |
parent | 1a0e176ba1a55005ee04d187e4b20127603373d8 (diff) | |
parent | 57a5544f883ad9687c38270519edc7914912af5d (diff) | |
download | gitlab-ce-4c77c30fbfb3734fd893f7cfe540fa595ea6539c.tar.gz |
Merge branch '33620-remove-events-from-notification_settings' into 'master'
Resolve "Remove `events` from `notification_settings`"
Closes #33620
See merge request !13152
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/notification_settings.rb | 1 | ||||
-rw-r--r-- | spec/models/notification_setting_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/api/notification_settings_spec.rb | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 4 |
4 files changed, 10 insertions, 11 deletions
diff --git a/spec/factories/notification_settings.rb b/spec/factories/notification_settings.rb index b5e96d18b8f..ee41997e41a 100644 --- a/spec/factories/notification_settings.rb +++ b/spec/factories/notification_settings.rb @@ -3,6 +3,5 @@ FactoryGirl.define do source factory: :empty_project user level 3 - events [] end end diff --git a/spec/models/notification_setting_spec.rb b/spec/models/notification_setting_spec.rb index 07e296424ca..2a0d102d3fe 100644 --- a/spec/models/notification_setting_spec.rb +++ b/spec/models/notification_setting_spec.rb @@ -63,24 +63,20 @@ RSpec.describe NotificationSetting do end end - describe 'event_enabled?' do + describe '#event_enabled?' do before do subject.update!(user: create(:user)) end context 'for an event with a matching column name' do - before do - subject.update!(events: { new_note: true }.to_json) - end - it 'returns the value of the column' do - subject.update!(new_note: false) + subject.update!(new_note: true) - expect(subject.event_enabled?(:new_note)).to be(false) + expect(subject.event_enabled?(:new_note)).to be(true) end context 'when the column has a nil value' do - it 'returns the value from the events hash' do + it 'returns false' do expect(subject.event_enabled?(:new_note)).to be(false) end end diff --git a/spec/requests/api/notification_settings_spec.rb b/spec/requests/api/notification_settings_spec.rb index f619b7e6eaf..d0e7a82e607 100644 --- a/spec/requests/api/notification_settings_spec.rb +++ b/spec/requests/api/notification_settings_spec.rb @@ -72,8 +72,8 @@ describe API::NotificationSettings do expect(response).to have_http_status(200) expect(json_response['level']).to eq(user.reload.notification_settings_for(project).level) - expect(json_response['events']['new_note']).to eq(true) - expect(json_response['events']['new_issue']).to eq(false) + expect(json_response['events']['new_note']).to be_truthy + expect(json_response['events']['new_issue']).to be_falsey end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 85335643921..609998d6e9c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -129,10 +129,14 @@ RSpec.configure do |config| config.before(:example, :migration) do ActiveRecord::Migrator .migrate(migrations_paths, previous_migration.version) + + ActiveRecord::Base.descendants.each(&:reset_column_information) end config.after(:example, :migration) do ActiveRecord::Migrator.migrate(migrations_paths) + + ActiveRecord::Base.descendants.each(&:reset_column_information) end config.around(:each, :nested_groups) do |example| |