diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /spec/services/quick_actions/interpret_service_spec.rb | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'spec/services/quick_actions/interpret_service_spec.rb')
-rw-r--r-- | spec/services/quick_actions/interpret_service_spec.rb | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index 2d38d968ce4..a43f3bc55bf 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -1393,14 +1393,41 @@ RSpec.describe QuickActions::InterpretService do let(:issuable) { issue } end + # /draft is a toggle (ff disabled) it_behaves_like 'draft command' do let(:content) { '/draft' } let(:issuable) { merge_request } + + before do + stub_feature_flags(draft_quick_action_non_toggle: false) + end end + # /draft is a toggle (ff disabled) it_behaves_like 'ready command' do let(:content) { '/draft' } let(:issuable) { merge_request } + + before do + stub_feature_flags(draft_quick_action_non_toggle: false) + issuable.update!(title: issuable.draft_title) + end + end + + # /draft is one way (ff enabled) + it_behaves_like 'draft command' do + let(:content) { '/draft' } + let(:issuable) { merge_request } + end + + # /draft is one way (ff enabled) + it_behaves_like 'draft/ready command no action' do + let(:content) { '/draft' } + let(:issuable) { merge_request } + + before do + issuable.update!(title: issuable.draft_title) + end end it_behaves_like 'draft/ready command no action' do @@ -2646,7 +2673,28 @@ RSpec.describe QuickActions::InterpretService do end end - describe 'draft command' do + describe 'draft command toggle (deprecated)' do + let(:content) { '/draft' } + + before do + stub_feature_flags(draft_quick_action_non_toggle: false) + end + + it 'includes the new status' do + _, explanations = service.explain(content, merge_request) + + expect(explanations).to match_array(['Marks this merge request as a draft.']) + end + + it 'sets the ready status on a draft' do + merge_request.update!(title: merge_request.draft_title) + _, explanations = service.explain(content, merge_request) + + expect(explanations).to match_array(["Marks this merge request as ready."]) + end + end + + describe 'draft command set' do let(:content) { '/draft' } it 'includes the new status' do @@ -2654,6 +2702,13 @@ RSpec.describe QuickActions::InterpretService do expect(explanations).to match_array(['Marks this merge request as a draft.']) end + + it 'includes the no change message when status unchanged' do + merge_request.update!(title: merge_request.draft_title) + _, explanations = service.explain(content, merge_request) + + expect(explanations).to match_array(["No change to this merge request's draft status."]) + end end describe 'ready command' do |