diff options
Diffstat (limited to 'spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb')
-rw-r--r-- | spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb index 2e1a3c496cc..3e62e8f473c 100644 --- a/spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe Gitlab::GithubImport::Importer::PullRequestReviewImporter, :clean_gitlab_redis_cache do +RSpec.describe Gitlab::GithubImport::Importer::PullRequestReviewImporter, + :clean_gitlab_redis_cache, feature_category: :importers do using RSpec::Parameterized::TableSyntax let_it_be(:merge_request) { create(:merge_request) } @@ -39,6 +40,19 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestReviewImporter, :clean expect(merge_request.reviewers).to contain_exactly(author) end end + + context 'when because of concurrency an attempt of duplication appeared' do + before do + allow(MergeRequestReviewer) + .to receive(:create!).and_raise(ActiveRecord::RecordNotUnique) + end + + it 'does not change Merge Request reviewers', :aggregate_failures do + expect { subject.execute }.not_to change(MergeRequestReviewer, :count) + + expect(merge_request.reviewers).to contain_exactly(author) + end + end end shared_examples 'imports an approval for the Merge Request' do |