From ceaafd3a6e253f6af827b9c9ede37150c3ed3b95 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Fri, 28 Oct 2016 10:35:46 -0500 Subject: Add commit_box spec --- .../projects/commit/_commit_box.html.haml_spec.rb | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spec/views/projects/commit/_commit_box.html.haml_spec.rb (limited to 'spec/views') 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 -- cgit v1.2.3