summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorClement Ho <clementh@hp.com>2016-07-25 23:49:06 -0500
committerClement Ho <clementh@hp.com>2016-08-02 11:40:44 -0500
commite4c517a635b6a45a9afc65b37682cc4b4951e922 (patch)
treedc8b1a82b60376ff2deca3e474397547147c84e8 /spec
parentb6dc87cb28058fdc2d5a735f896742fecb5901ec (diff)
downloadgitlab-ce-e4c517a635b6a45a9afc65b37682cc4b4951e922.tar.gz
Expand commit message width in repo view
Diffstat (limited to 'spec')
-rw-r--r--spec/models/commit_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index c3392ee7440..d3e6a6648cc 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -86,6 +86,27 @@ eos
end
end
+ describe '#full_title' do
+ it "returns no_commit_message when safe_message is blank" do
+ allow(commit).to receive(:safe_message).and_return('')
+ expect(commit.full_title).to eq("--no commit message")
+ end
+
+ it "returns entire message if there is no newline" do
+ message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.'
+
+ allow(commit).to receive(:safe_message).and_return(message)
+ expect(commit.full_title).to eq(message)
+ end
+
+ it "returns first line of message if there is a newLine" do
+ message = commit.safe_message.split(" ").first
+
+ allow(commit).to receive(:safe_message).and_return(message + "\n" + message)
+ expect(commit.full_title).to eq(message)
+ end
+ end
+
describe "delegation" do
subject { commit }