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

20231207194620_backfill_catalog_resources_visibility_level_spec.rb « migrations « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9023aa705a1ea52352ae12fca64fb42f02682454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'spec_helper'
require_migration!

RSpec.describe BackfillCatalogResourcesVisibilityLevel, feature_category: :pipeline_composition do
  let(:namespace) { table(:namespaces).create!(name: 'name', path: 'path') }

  let(:project) do
    table(:projects).create!(
      visibility_level: Gitlab::VisibilityLevel::INTERNAL,
      namespace_id: namespace.id, project_namespace_id: namespace.id
    )
  end

  let(:resource) { table(:catalog_resources).create!(project_id: project.id) }

  describe '#up' do
    it 'updates the visibility_level to match the project' do
      expect(resource.visibility_level).to eq(0)

      migrate!

      expect(resource.reload.visibility_level).to eq(Gitlab::VisibilityLevel::INTERNAL)
    end
  end
end