Commit c8ae8e7a authored by Peter Leitzen's avatar Peter Leitzen Committed by Sean McGivern

Show optional tag message in quick action explanation

parent 8a21f0c0
...@@ -584,8 +584,9 @@ module QuickActions ...@@ -584,8 +584,9 @@ module QuickActions
end end
desc 'Tag this commit.' desc 'Tag this commit.'
explanation do |(tag_name), _| explanation do |(tag_name, message)|
"Tags this commit to #{tag_name}." with_message = %{ with "#{message}"} if message.present?
"Tags this commit to #{tag_name}#{with_message}."
end end
params 'v1.2.3 <message>' params 'v1.2.3 <message>'
parse_params do |tag_name_and_message| parse_params do |tag_name_and_message|
......
...@@ -1433,12 +1433,36 @@ describe QuickActions::InterpretService do ...@@ -1433,12 +1433,36 @@ describe QuickActions::InterpretService do
end end
describe 'tag a commit' do describe 'tag a commit' do
let(:content) { '/tag 1.2.3 some message' } describe 'with a tag name' do
context 'without a message' do
let(:content) { '/tag v1.2.3' }
it 'includes the tag name' do it 'includes the tag name only' do
_, explanations = service.explain(content, commit) _, explanations = service.explain(content, commit)
expect(explanations).to eq(["Tags this commit to 1.2.3."]) expect(explanations).to eq(["Tags this commit to v1.2.3."])
end
end
context 'with an empty message' do
let(:content) { '/tag v1.2.3 ' }
it 'includes the tag name only' do
_, explanations = service.explain(content, commit)
expect(explanations).to eq(["Tags this commit to v1.2.3."])
end
end
end
describe 'with a tag name and message' do
let(:content) { '/tag v1.2.3 Stable release' }
it 'includes the tag name and message' do
_, explanations = service.explain(content, commit)
expect(explanations).to eq(["Tags this commit to v1.2.3 with \"Stable release\"."])
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment