diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /spec/migrations/20210430135954_copy_adoption_segments_namespace_spec.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/migrations/20210430135954_copy_adoption_segments_namespace_spec.rb')
-rw-r--r-- | spec/migrations/20210430135954_copy_adoption_segments_namespace_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/migrations/20210430135954_copy_adoption_segments_namespace_spec.rb b/spec/migrations/20210430135954_copy_adoption_segments_namespace_spec.rb new file mode 100644 index 00000000000..a37772db28c --- /dev/null +++ b/spec/migrations/20210430135954_copy_adoption_segments_namespace_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +require Rails.root.join('db', 'post_migrate', '20210430135954_copy_adoption_segments_namespace.rb') + +RSpec.describe CopyAdoptionSegmentsNamespace, :migration do + let(:namespaces_table) { table(:namespaces) } + let(:segments_table) { table(:analytics_devops_adoption_segments) } + + before do + namespaces_table.create!(id: 123, name: 'group1', path: 'group1') + namespaces_table.create!(id: 124, name: 'group2', path: 'group2') + + segments_table.create!(id: 1, namespace_id: 123, display_namespace_id: nil) + segments_table.create!(id: 2, namespace_id: 124, display_namespace_id: 123) + end + + it 'updates all segments without display namespace' do + migrate! + + expect(segments_table.find(1).display_namespace_id).to eq 123 + expect(segments_table.find(2).display_namespace_id).to eq 123 + end +end |