summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2016-10-28 10:35:46 -0500
committerAnnabel Dunstone Gray <annabel.dunstone@gmail.com>2016-10-28 10:35:46 -0500
commitceaafd3a6e253f6af827b9c9ede37150c3ed3b95 (patch)
tree390ab7cb34fa4ffeb5f3ebe9fba38a433ebb4044
parent3f979481a1592d274e3b032ce74070f30645a184 (diff)
downloadgitlab-ce-ceaafd3a6e253f6af827b9c9ede37150c3ed3b95.tar.gz
Add commit_box spec
-rw-r--r--spec/views/projects/commit/_commit_box.html.haml_spec.rb28
1 files changed, 28 insertions, 0 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
new file mode 100644
index 00000000000..eaf5a0ee1bd
--- /dev/null
+++ b/spec/views/projects/commit/_commit_box.html.haml_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe 'projects/commit/_commit_box.html.haml' do
+ include Devise::Test::ControllerHelpers
+
+ let(:project) { create(:project) }
+
+ before do
+ assign(:project, project)
+ assign(:commit, project.commit)
+ end
+
+ it 'shows the commit SHA' do
+ render
+
+ expect(rendered).to have_text("Commit #{Commit.truncate_sha(project.commit.sha)}")
+ end
+
+ it 'shows the last pipeline that ran for the commit' do
+ first_pipeline = create(:ci_pipeline, project: project, sha: project.commit.id, status: 'success')
+ second_pipeline = 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
+
+ expect(rendered).to have_text("Pipeline ##{third_pipeline.id} for #{Commit.truncate_sha(project.commit.sha)} failed")
+ end
+end