Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/migrations/20230822104028_delete_project_callout_three_spec.rb')
-rw-r--r--spec/migrations/20230822104028_delete_project_callout_three_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/migrations/20230822104028_delete_project_callout_three_spec.rb b/spec/migrations/20230822104028_delete_project_callout_three_spec.rb
new file mode 100644
index 00000000000..127af643976
--- /dev/null
+++ b/spec/migrations/20230822104028_delete_project_callout_three_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+require_migration!
+
+RSpec.describe DeleteProjectCalloutThree, feature_category: :groups_and_projects do
+ let(:migration) { described_class.new }
+
+ let(:user) { table(:users).create!(name: 'test', email: 'test@example.com', projects_limit: 5) }
+ let(:namespace) { table(:namespaces).create!(name: 'name', path: 'path') }
+ let(:project) { table(:projects).create!(namespace_id: namespace.id, project_namespace_id: namespace.id) }
+ let(:project_callout) { table(:user_project_callouts) }
+
+ let!(:project_callouts_1) { project_callout.create!(project_id: project.id, user_id: user.id, feature_name: 1) }
+ let!(:project_callouts_3) { project_callout.create!(project_id: project.id, user_id: user.id, feature_name: 3) }
+
+ it 'deletes only feature name 3' do
+ expect { migrate! }.to change { project_callout.count }.from(2).to(1)
+ expect(project_callout.find_by_id(project_callouts_3.id)).to be_nil
+ end
+end