Commit 5759bfe0 authored by Sean McGivern's avatar Sean McGivern

Make it clearer when Commit#description returns no_commit_message

parent e3f13c9e
...@@ -193,13 +193,10 @@ class Commit ...@@ -193,13 +193,10 @@ class Commit
# otherwise returns commit message without first line # otherwise returns commit message without first line
def description def description
return safe_message if full_title.length >= 100 return safe_message if full_title.length >= 100
return no_commit_message if safe_message.blank?
if safe_message.blank?
no_commit_message
else
safe_message.split("\n", 2)[1].try(:chomp) safe_message.split("\n", 2)[1].try(:chomp)
end end
end
def description? def description?
description.present? description.present?
......
...@@ -225,9 +225,10 @@ eos ...@@ -225,9 +225,10 @@ eos
end end
describe 'description' do describe 'description' do
it "returns no_commit_message when safe_message is blank" do it 'returns no_commit_message when safe_message is blank' do
allow(commit).to receive(:safe_message).and_return('') allow(commit).to receive(:safe_message).and_return(nil)
expect(commit.description).to eq("--no commit message")
expect(commit.description).to eq('--no commit message')
end end
it 'returns description of commit message if title less than 100 characters' do it 'returns description of commit message if title less than 100 characters' do
......
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