diff options
author | ubudzisz <ubudzisz@gmail.com> | 2016-07-11 09:11:20 +0200 |
---|---|---|
committer | ubudzisz <ubudzisz@gmail.com> | 2016-07-18 12:39:24 +0200 |
commit | fda1d011824c24fc38dcac0e2fc795a4515ae2ec (patch) | |
tree | 1f293d0caad0571c262cc4f7f1fd4b0088e4007a | |
parent | af1a6f0533854cca76d4b0bcf2059131a1bfd106 (diff) | |
download | gitlab-ce-fda1d011824c24fc38dcac0e2fc795a4515ae2ec.tar.gz |
add git-commit-title-method into pipeline model and modify view
add git-commit-title-method into tests
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/views/projects/builds/_sidebar.html.haml | 2 | ||||
-rw-r--r-- | spec/views/projects/builds/show.html.haml_spec.rb | 9 |
3 files changed, 14 insertions, 1 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index b468434866b..a65a826536d 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -51,6 +51,10 @@ module Ci commit.try(:message) end + def git_commit_title + commit.try(:title) + end + def short_sha Ci::Pipeline.truncate_sha(sha) end diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml index 3fc1157ddcb..396cc4ad925 100644 --- a/app/views/projects/builds/_sidebar.html.haml +++ b/app/views/projects/builds/_sidebar.html.haml @@ -96,7 +96,7 @@ .title Commit title %p.build-light-text.append-bottom-0 - #{@build.pipeline.commit.try(:title)} + #{@build.pipeline.git_commit_title} - if @build.tags.any? .block diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index cd18d19ef5e..7051e084375 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -22,6 +22,10 @@ describe 'projects/builds/show' do it 'does not show retry button' do expect(rendered).not_to have_link('Retry') end + + it 'shows commit title' do + expect(rendered).to have_text(@git_commit_title) + end end context 'when build is not running' do @@ -33,5 +37,10 @@ describe 'projects/builds/show' do it 'shows retry button' do expect(rendered).to have_link('Retry') end + + it 'shows commit title' do + expect(rendered).to have_text(@git_commit_title) + end end + end |