diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-21 22:17:14 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-21 22:17:14 +0200 |
commit | ec586042e0f23696f0b3b34a7e7d5bf7c36ea2c7 (patch) | |
tree | 8d470e255e3976bed20072a1020dcad8bb0d71e0 /spec/views | |
parent | ff986c7040f594f19225274896fdbaa34bc8a713 (diff) | |
download | gitlab-ce-ec586042e0f23696f0b3b34a7e7d5bf7c36ea2c7.tar.gz |
Fix lastest commit status text on main project page
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/_last_commit.html.haml_spec.rb | 22 | ||||
-rw-r--r-- | spec/views/projects/commit/_commit_box.html.haml_spec.rb | 34 |
2 files changed, 47 insertions, 9 deletions
diff --git a/spec/views/projects/_last_commit.html.haml_spec.rb b/spec/views/projects/_last_commit.html.haml_spec.rb new file mode 100644 index 00000000000..eea1695b171 --- /dev/null +++ b/spec/views/projects/_last_commit.html.haml_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe 'projects/_last_commit', :view do + let(:project) { create(:project, :repository) } + + context 'when there is a pipeline present for the commit' do + context 'when pipeline is blocked' do + let!(:pipeline) do + create(:ci_pipeline, :blocked, project: project, + sha: project.commit.id) + end + + it 'shows correct pipeline badge' do + render 'projects/last_commit', commit: project.commit, + project: project, + ref: :master + + expect(rendered).to have_text "blocked #{project.commit.short_id}" + end + end + end +end diff --git a/spec/views/projects/commit/_commit_box.html.haml_spec.rb b/spec/views/projects/commit/_commit_box.html.haml_spec.rb index cec87dcecc8..ab120929c6c 100644 --- a/spec/views/projects/commit/_commit_box.html.haml_spec.rb +++ b/spec/views/projects/commit/_commit_box.html.haml_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' -describe 'projects/commit/_commit_box.html.haml' do - include Devise::Test::ControllerHelpers - +describe 'projects/commit/_commit_box.html.haml', :view do let(:user) { create(:user) } let(:project) { create(:project, :repository) } @@ -18,14 +16,32 @@ describe 'projects/commit/_commit_box.html.haml' do expect(rendered).to have_text("#{Commit.truncate_sha(project.commit.sha)}") end - it 'shows the last pipeline that ran for the commit' do - create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success') - create(:ci_pipeline, project: project, sha: project.commit.id, status: 'canceled') - third_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'failed') + context 'when there is a pipeline present' do + context 'when there are multiple pipelines for a commit' do + it 'shows the last pipeline' do + create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success') + create(:ci_pipeline, project: project, sha: project.commit.id, status: 'canceled') + third_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'failed') - render + render + + expect(rendered).to have_text("Pipeline ##{third_pipeline.id} failed") + end + end - expect(rendered).to have_text("Pipeline ##{third_pipeline.id} failed") + context 'when pipeline for the commit is blocked' do + let!(:pipeline) do + create(:ci_pipeline, :blocked, project: project, + sha: project.commit.id) + end + + it 'shows correct pipeline description' do + render + + expect(rendered).to have_text "Pipeline ##{pipeline.id} " \ + 'waiting for manual action' + end + end end context 'viewing a commit' do |