From 4472779b7f93e07558f5afa1b1f6b23564de3ccd Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Wed, 25 Jan 2017 11:30:08 +0000 Subject: [PATCH] Adds tests to build view Fix CHANGELOG entry --- app/views/projects/builds/_header.html.haml | 2 +- .../26947-build-status-self-link.yml | 4 +-- .../projects/builds/show.html.haml_spec.rb | 26 +++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml index b15be0d861d..91eeee1800e 100644 --- a/app/views/projects/builds/_header.html.haml +++ b/app/views/projects/builds/_header.html.haml @@ -2,7 +2,7 @@ .header-content = render 'ci/status/badge', status: @build.detailed_status(current_user) Build - %strong ##{@build.id} + %strong.js-build-id ##{@build.id} in pipeline = link_to pipeline_path(@build.pipeline) do %strong ##{@build.pipeline.id} diff --git a/changelogs/unreleased/26947-build-status-self-link.yml b/changelogs/unreleased/26947-build-status-self-link.yml index 5a165d5b96e..a6444eef838 100644 --- a/changelogs/unreleased/26947-build-status-self-link.yml +++ b/changelogs/unreleased/26947-build-status-self-link.yml @@ -1,4 +1,4 @@ --- title: Add new ci status partial to render a badge without a link -merge_request: -author: 8740 +merge_request: 8740 +author: diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index 745d0c745bd..585906b9d31 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -15,6 +15,32 @@ describe 'projects/builds/show', :view do allow(view).to receive(:can?).and_return(true) end + describe 'build information in header' do + let(:build) do + create(:ci_build, :success, environment: 'staging') + end + + before do + render + end + + it 'shows status name' do + expect(rendered).to have_css('.ci-status.ci-success', text: 'passed') + end + + it 'shows build id' do + expect(rendered).to have_css('.js-build-id', text: build.id) + end + + it 'shows a link to the pipeline' do + expect(rendered).to have_link(build.pipeline.id) + end + + it 'shows a link to the commit' do + expect(rendered).to have_link(build.pipeline.short_sha) + end + end + describe 'environment info in build view' do context 'build with latest deployment' do let(:build) do