diff options
author | Alex Ives <alex@ives.mn> | 2017-07-24 22:11:22 -0500 |
---|---|---|
committer | Alex Ives <alex@ives.mn> | 2017-07-28 14:37:44 -0500 |
commit | a07fe9d7f8f922020472ed54b060430a6da3da69 (patch) | |
tree | 0dec18fd2ed81985112ce1a2cee1bcde37e12155 /spec/services/quick_actions | |
parent | da967803cce971b184873dbe5d65d07215de0b0a (diff) | |
download | gitlab-ce-a07fe9d7f8f922020472ed54b060430a6da3da69.tar.gz |
Fixes #29385: Add /shrug and /tableflip commands
- Updated DSL to support substitution definitions
- Added substitution definition, inherits from command definition
- Added tabelflip and shrug substitutions to interpret service
- Added support for substitution definitions to the extractor for preview mode.
- Added substitution handling in the interpret service
Signed-off-by: Alex Ives <alex@ives.mn>
Diffstat (limited to 'spec/services/quick_actions')
-rw-r--r-- | spec/services/quick_actions/interpret_service_spec.rb | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index 42a4a2591ea..92bde2c92bf 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -9,13 +9,13 @@ describe QuickActions::InterpretService do let(:inprogress) { create(:label, project: project, title: 'In Progress') } let(:bug) { create(:label, project: project, title: 'Bug') } let(:note) { build(:note, commit_id: merge_request.diff_head_sha) } + let(:service) { described_class.new(project, developer) } before do project.team << [developer, :developer] end describe '#execute' do - let(:service) { described_class.new(project, developer) } let(:merge_request) { create(:merge_request, source_project: project) } shared_examples 'reopen command' do @@ -270,6 +270,22 @@ describe QuickActions::InterpretService do end end + shared_examples 'shrug command' do + it 'appends ¯\_(ツ)_/¯ to the comment' do + new_content, _ = service.execute(content, issuable) + + expect(new_content).to end_with(described_class::SHRUG) + end + end + + shared_examples 'tableflip command' do + it 'appends (╯°□°)╯︵ ┻━┻ to the comment' do + new_content, _ = service.execute(content, issuable) + + expect(new_content).to end_with(described_class::TABLEFLIP) + end + end + it_behaves_like 'reopen command' do let(:content) { '/reopen' } let(:issuable) { issue } @@ -775,6 +791,30 @@ describe QuickActions::InterpretService do end end + context '/shrug command' do + it_behaves_like 'shrug command' do + let(:content) { '/shrug people are people' } + let(:issuable) { issue } + end + + it_behaves_like 'shrug command' do + let(:content) { '/shrug' } + let(:issuable) { issue } + end + end + + context '/tableflip command' do + it_behaves_like 'tableflip command' do + let(:content) { '/tableflip curse your sudden but enviable betrayal' } + let(:issuable) { issue } + end + + it_behaves_like 'tableflip command' do + let(:content) { '/tableflip' } + let(:issuable) { issue } + end + end + context '/target_branch command' do let(:non_empty_project) { create(:project, :repository) } let(:another_merge_request) { create(:merge_request, author: developer, source_project: non_empty_project) } |