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/20231207194620_backfill_catalog_resources_visibility_level_spec.rb')
-rw-r--r--spec/migrations/20231207194620_backfill_catalog_resources_visibility_level_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/migrations/20231207194620_backfill_catalog_resources_visibility_level_spec.rb b/spec/migrations/20231207194620_backfill_catalog_resources_visibility_level_spec.rb
new file mode 100644
index 00000000000..9023aa705a1
--- /dev/null
+++ b/spec/migrations/20231207194620_backfill_catalog_resources_visibility_level_spec.rb
@@ -0,0 +1,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