diff options
Diffstat (limited to 'spec/services/quick_actions/interpret_service_spec.rb')
-rw-r--r-- | spec/services/quick_actions/interpret_service_spec.rb | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index 6f3814095f9..1f521ed4a93 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -312,8 +312,8 @@ RSpec.describe QuickActions::InterpretService do end end - shared_examples 'wip command' do - it 'returns wip_event: "wip" if content contains /wip' do + shared_examples 'draft command' do + it 'returns wip_event: "wip" if content contains /draft' do _, updates, _ = service.execute(content, issuable) expect(updates).to eq(wip_event: 'wip') @@ -322,12 +322,12 @@ RSpec.describe QuickActions::InterpretService do it 'returns the wip message' do _, _, message = service.execute(content, issuable) - expect(message).to eq("Marked this #{issuable.to_ability_name.humanize(capitalize: false)} as Work In Progress.") + expect(message).to eq("Marked this #{issuable.to_ability_name.humanize(capitalize: false)} as a draft.") end end - shared_examples 'unwip command' do - it 'returns wip_event: "unwip" if content contains /wip' do + shared_examples 'undraft command' do + it 'returns wip_event: "unwip" if content contains /draft' do issuable.update!(title: issuable.wip_title) _, updates, _ = service.execute(content, issuable) @@ -338,7 +338,7 @@ RSpec.describe QuickActions::InterpretService do issuable.update!(title: issuable.wip_title) _, _, message = service.execute(content, issuable) - expect(message).to eq("Unmarked this #{issuable.to_ability_name.humanize(capitalize: false)} as Work In Progress.") + expect(message).to eq("Unmarked this #{issuable.to_ability_name.humanize(capitalize: false)} as a draft.") end end @@ -1026,16 +1026,26 @@ RSpec.describe QuickActions::InterpretService do let(:issuable) { issue } end - it_behaves_like 'wip command' do + it_behaves_like 'draft command' do let(:content) { '/wip' } let(:issuable) { merge_request } end - it_behaves_like 'unwip command' do + it_behaves_like 'undraft command' do let(:content) { '/wip' } let(:issuable) { merge_request } end + it_behaves_like 'draft command' do + let(:content) { '/draft' } + let(:issuable) { merge_request } + end + + it_behaves_like 'undraft command' do + let(:content) { '/draft' } + let(:issuable) { merge_request } + end + it_behaves_like 'empty command' do let(:content) { '/remove_due_date' } let(:issuable) { merge_request } @@ -1896,13 +1906,13 @@ RSpec.describe QuickActions::InterpretService do end end - describe 'wip command' do - let(:content) { '/wip' } + describe 'draft command' do + let(:content) { '/draft' } it 'includes the new status' do _, explanations = service.explain(content, merge_request) - expect(explanations).to eq(['Marks this merge request as Work In Progress.']) + expect(explanations).to eq(['Marks this merge request as a draft.']) end end |