summaryrefslogtreecommitdiff
path: root/spec/views/projects/commit/_commit_box.html.haml_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-21 22:17:14 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-04-21 22:17:14 +0200
commitec586042e0f23696f0b3b34a7e7d5bf7c36ea2c7 (patch)
tree8d470e255e3976bed20072a1020dcad8bb0d71e0 /spec/views/projects/commit/_commit_box.html.haml_spec.rb
parentff986c7040f594f19225274896fdbaa34bc8a713 (diff)
downloadgitlab-ce-ec586042e0f23696f0b3b34a7e7d5bf7c36ea2c7.tar.gz
Fix lastest commit status text on main project page
Diffstat (limited to 'spec/views/projects/commit/_commit_box.html.haml_spec.rb')
-rw-r--r--spec/views/projects/commit/_commit_box.html.haml_spec.rb34
1 files changed, 25 insertions, 9 deletions
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