summaryrefslogtreecommitdiff
path: root/spec/models/commit_spec.rb
diff options
context:
space:
mode:
authoryisiliang <yisiliang@foxmail.com>2018-02-07 15:30:30 +0000
committerSean McGivern <sean@gitlab.com>2018-08-21 10:41:47 +0100
commit0d642e1e3c3619027876034f5af1116d00d96046 (patch)
tree48454e7ebef188f75cd62ec845eecb94f7f2db11 /spec/models/commit_spec.rb
parentf5e6c44741bc1b4e610cec4eec66d676f6b1ca36 (diff)
downloadgitlab-ce-0d642e1e3c3619027876034f5af1116d00d96046.tar.gz
to avoid “NoMethodError (undefined method `split' for nil:NilClass)” while safe_message is nil.
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 5157d8fc645..ab241b83077 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -225,6 +225,11 @@ 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")
+ 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.