Skip to content
Snippets Groups Projects
Commit 5759bfe0 authored by Sean McGivern's avatar Sean McGivern
Browse files

Make it clearer when Commit#description returns no_commit_message

parent e3f13c9e
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -193,12 +193,9 @@ class Commit
# otherwise returns commit message without first line
def description
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)
end
safe_message.split("\n", 2)[1].try(:chomp)
end
 
def description?
Loading
Loading
Loading
Loading
@@ -225,11 +225,12 @@ eos
end
 
describe 'description' do
it "returns no_commit_message when safe_message is blank" do
allow(commit).to receive(:safe_message).and_return('')
expect(commit.description).to eq("--no commit message")
it 'returns no_commit_message when safe_message is blank' do
allow(commit).to receive(:safe_message).and_return(nil)
expect(commit.description).to eq('--no commit message')
end
it 'returns description of commit message if title less than 100 characters' do
message = <<eos
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment