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

20230822104028_delete_project_callout_three_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 127af643976c38692a6c4124cc0504421510f669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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