summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorThomas Balthazar <thomas@balthazar.info>2016-09-08 11:18:41 +0200
committerThomas Balthazar <thomas@balthazar.info>2016-10-03 09:36:21 +0200
commitddbe676dc318b87c3d656a08bbf5d75485ad544b (patch)
treedb8d14ffb9979d8d46772776237e33815848222e /spec/services
parentbcb2699f04646e4738bb87410aab49b2c3a686fb (diff)
downloadgitlab-ce-ddbe676dc318b87c3d656a08bbf5d75485ad544b.tar.gz
Add a /wip slash command
It toggles the 'WIP' prefix in the MR title.
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/slash_commands/interpret_service_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/services/slash_commands/interpret_service_spec.rb b/spec/services/slash_commands/interpret_service_spec.rb
index 5b1edba87a1..ae4d286d250 100644
--- a/spec/services/slash_commands/interpret_service_spec.rb
+++ b/spec/services/slash_commands/interpret_service_spec.rb
@@ -165,6 +165,23 @@ describe SlashCommands::InterpretService, services: true do
end
end
+ shared_examples 'wip command' do
+ it 'returns wip_event: "wip" if content contains /wip' do
+ _, updates = service.execute(content, issuable)
+
+ expect(updates).to eq(wip_event: 'wip')
+ end
+ end
+
+ shared_examples 'unwip command' do
+ it 'returns wip_event: "unwip" if content contains /wip' do
+ issuable.update(title: issuable.wip_title)
+ _, updates = service.execute(content, issuable)
+
+ expect(updates).to eq(wip_event: 'unwip')
+ end
+ end
+
shared_examples 'empty command' do
it 'populates {} if content contains an unsupported command' do
_, updates = service.execute(content, issuable)
@@ -376,6 +393,16 @@ describe SlashCommands::InterpretService, services: true do
let(:issuable) { issue }
end
+ it_behaves_like 'wip command' do
+ let(:content) { '/wip' }
+ let(:issuable) { merge_request }
+ end
+
+ it_behaves_like 'unwip command' do
+ let(:content) { '/wip' }
+ let(:issuable) { merge_request }
+ end
+
it_behaves_like 'empty command' do
let(:content) { '/remove_due_date' }
let(:issuable) { merge_request }