diff options
Diffstat (limited to 'spec/services/draft_notes/publish_service_spec.rb')
-rw-r--r-- | spec/services/draft_notes/publish_service_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/services/draft_notes/publish_service_spec.rb b/spec/services/draft_notes/publish_service_spec.rb index e087f2ffc7e..fbc38f93c56 100644 --- a/spec/services/draft_notes/publish_service_spec.rb +++ b/spec/services/draft_notes/publish_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe DraftNotes::PublishService, feature_category: :code_review_workflow do include RepoHelpers - let(:merge_request) { create(:merge_request) } + let_it_be(:merge_request) { create(:merge_request, reviewers: create_list(:user, 1)) } let(:project) { merge_request.target_project } let(:user) { merge_request.author } let(:commit) { project.commit(sample_commit.id) } @@ -198,6 +198,29 @@ RSpec.describe DraftNotes::PublishService, feature_category: :code_review_workfl end end end + + it 'does not call UpdateReviewerStateService' do + publish + + expect(MergeRequests::UpdateReviewerStateService).not_to receive(:new) + end + + context 'when `mr_request_changes` feature flag is disabled' do + before do + stub_feature_flags(mr_request_changes: false) + end + + it 'calls UpdateReviewerStateService' do + expect_next_instance_of( + MergeRequests::UpdateReviewerStateService, + project: project, current_user: user + ) do |service| + expect(service).to receive(:execute).with(merge_request, "reviewed") + end + + publish + end + end end context 'draft notes with suggestions' do |