diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/migrations/delete_user_callout_alerts_moved_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/migrations/delete_user_callout_alerts_moved_spec.rb')
-rw-r--r-- | spec/migrations/delete_user_callout_alerts_moved_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/migrations/delete_user_callout_alerts_moved_spec.rb b/spec/migrations/delete_user_callout_alerts_moved_spec.rb new file mode 100644 index 00000000000..f6b1a8982fb --- /dev/null +++ b/spec/migrations/delete_user_callout_alerts_moved_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' +require Rails.root.join('db', 'post_migrate', '20200710102418_delete_user_callout_alerts_moved.rb') + +RSpec.describe DeleteUserCalloutAlertsMoved do + let(:users) { table(:users) } + let(:user_callouts) { table(:user_callouts) } + let(:alerts_moved_feature) { described_class::FEATURE_NAME_ALERTS_MOVED } + let(:unrelated_feature) { 1 } + + let!(:user1) { users.create!(email: '1', projects_limit: 0) } + let!(:user2) { users.create!(email: '2', projects_limit: 0) } + + subject(:migration) { described_class.new } + + before do + user_callouts.create!(user_id: user1.id, feature_name: alerts_moved_feature) + user_callouts.create!(user_id: user1.id, feature_name: unrelated_feature) + user_callouts.create!(user_id: user2.id, feature_name: alerts_moved_feature) + end + + describe '#up' do + it 'deletes `alerts_moved` user callouts' do + migration.up + + expect(user_callouts.all.map(&:feature_name)).to eq([unrelated_feature]) + end + end +end |