summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/github_import/importer/pull_request_review_importer_spec.rb
diff options
context:
space:
mode:
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.rb14
1 files changed, 12 insertions, 2 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 b2f993ac47c..290f3f51202 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
@@ -19,8 +19,10 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestReviewImporter, :clean
context 'when the review is "APPROVED"' do
let(:review) { create_review(type: 'APPROVED', note: '') }
- it 'creates a note for the review' do
- expect { subject.execute }.to change(Note, :count)
+ it 'creates a note for the review and approves the Merge Request' do
+ expect { subject.execute }
+ .to change(Note, :count).by(1)
+ .and change(Approval, :count).by(1)
last_note = merge_request.notes.last
expect(last_note.note).to eq('approved this merge request')
@@ -31,6 +33,14 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestReviewImporter, :clean
expect(merge_request.approved_by_users.reload).to include(author)
expect(merge_request.approvals.last.created_at).to eq(submitted_at)
end
+
+ it 'does nothing if the user already approved the merge request' do
+ create(:approval, merge_request: merge_request, user: author)
+
+ expect { subject.execute }
+ .to change(Note, :count).by(0)
+ .and change(Approval, :count).by(0)
+ end
end
context 'when the review is "COMMENTED"' do