From d392f147fc2b08cf3139e2cce2a264eaf0bc4a48 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 7 Sep 2016 14:52:13 +0200 Subject: Group similar builds --- app/models/commit_status.rb | 4 ++++ app/views/projects/commit/_pipeline.html.haml | 9 +++++++-- app/views/projects/commit/_pipeline_grouped_status.html.haml | 12 ++++++++++++ db/fixtures/development/14_pipelines.rb | 10 +++++++--- 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 app/views/projects/commit/_pipeline_grouped_status.html.haml diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 4a628924499..af739342256 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -95,6 +95,10 @@ class CommitStatus < ActiveRecord::Base pipeline.before_sha || Gitlab::Git::BLANK_SHA end + def group_name + name.gsub(/\d+[\s:]+\d+\s*/, '') + end + def self.stages # We group by stage name, but order stages by theirs' index unscoped.from(all, :sg).group('stage').order('max(stage_idx)', 'stage').pluck('sg.stage') diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml index 20a85148ab5..a330c14061f 100644 --- a/app/views/projects/commit/_pipeline.html.haml +++ b/app/views/projects/commit/_pipeline.html.haml @@ -39,8 +39,13 @@ = stage.titleize .builds-container %ul - - statuses.each do |status| - = render "projects/#{status.to_partial_path}_pipeline", subject: status + - status_groups = statuses.group_by(&:group_name) + - status_groups.each do |group_name, grouped_statuses| + - if grouped_statuses.one? + - status = grouped_statuses.first + = render "projects/#{status.to_partial_path}_pipeline", subject: status + - else + = render "projects/commit/pipeline_grouped_status", name: group_name, subject: grouped_statuses - if pipeline.yaml_errors.present? diff --git a/app/views/projects/commit/_pipeline_grouped_status.html.haml b/app/views/projects/commit/_pipeline_grouped_status.html.haml new file mode 100644 index 00000000000..7e02703f0a6 --- /dev/null +++ b/app/views/projects/commit/_pipeline_grouped_status.html.haml @@ -0,0 +1,12 @@ +%li.build + .curve + .build-content + - group_status = CommitStatus.where(id: subject).status + = render_status_with_link('build', group_status) + %span.ci-status-text + = name + = subject.length + + // Access all other grouped statuses + //- subject.each do |status| + // = render "projects/#{status.to_partial_path}_pipeline", subject: status diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb index 49e6e2361b1..650b410595c 100644 --- a/db/fixtures/development/14_pipelines.rb +++ b/db/fixtures/development/14_pipelines.rb @@ -3,9 +3,13 @@ class Gitlab::Seeder::Pipelines BUILDS = [ { name: 'build:linux', stage: 'build', status: :success }, { name: 'build:osx', stage: 'build', status: :success }, - { name: 'rspec:linux', stage: 'test', status: :success }, - { name: 'rspec:windows', stage: 'test', status: :success }, - { name: 'rspec:windows', stage: 'test', status: :success }, + { name: 'rspec:linux 0 3', stage: 'test', status: :success }, + { name: 'rspec:linux 1 3', stage: 'test', status: :success }, + { name: 'rspec:linux 2 3', stage: 'test', status: :success }, + { name: 'rspec:windows 0 3', stage: 'test', status: :success }, + { name: 'rspec:windows 1 3', stage: 'test', status: :success }, + { name: 'rspec:windows 2 3', stage: 'test', status: :success }, + { name: 'rspec:windows 2 3', stage: 'test', status: :success }, { name: 'rspec:osx', stage: 'test', status_event: :success }, { name: 'spinach:linux', stage: 'test', status: :success }, { name: 'spinach:osx', stage: 'test', status: :failed, allow_failure: true}, -- cgit v1.2.3 From 1ef8be768df68b42d238ca9368aea65982ad0659 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Wed, 7 Sep 2016 10:31:32 -0500 Subject: Style grouped builds dropdown --- app/assets/stylesheets/pages/pipelines.scss | 81 ++++++++++++++++++++-- .../projects/ci/builds/_build_pipeline.html.haml | 4 +- .../commit/_pipeline_grouped_status.html.haml | 29 ++++++-- 3 files changed, 99 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index 2d66ab25da6..cc71b8eb045 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -318,9 +318,17 @@ .build-content { width: 130px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + + .ci-status-text { + width: 110px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + display: inline-block; + position: relative; + top: -1px; + } a { color: $layout-link-gray; @@ -331,13 +339,74 @@ text-decoration: underline; } } + } + + .dropdown-menu-toggle { + border: none; + width: auto; + padding: 0; + color: $layout-link-gray; + + .ci-status-text { + width: 80px; + } + } + + .grouped-pipeline-dropdown { + padding: 8px 0; + width: 200px; + left: auto; + right: -214px; + top: -9px; + + a:hover { + .ci-status-text { + text-decoration: none; + } + } + + .ci-status-text { + width: 145px; + } + + .arrow { + &:before, + &:after { + content: ''; + display: inline-block; + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + top: 18px; + } + + &:before { + left: -5px; + margin-top: -6px; + border-width: 7px 5px 7px 0; + border-right-color: $border-color; + } + &:after { + left: -4px; + margin-top: -9px; + border-width: 10px 7px 10px 0; + border-right-color: $white-light; + } + } + } + + .badge { + background-color: $gray-dark; + color: $layout-link-gray; + font-weight: normal; } } svg { - position: relative; - top: 2px; + vertical-align: middle; margin-right: 5px; } @@ -442,7 +511,7 @@ width: 21px; height: 25px; position: absolute; - top: -28.5px; + top: -29px; border-top: 2px solid $border-color; } diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml index 36fb0300aeb..5289cd672f5 100644 --- a/app/views/projects/ci/builds/_build_pipeline.html.haml +++ b/app/views/projects/ci/builds/_build_pipeline.html.haml @@ -5,11 +5,11 @@ - if is_playable = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do = render_status_with_link('build', 'play') - %span.ci-status-text= subject.name + .ci-status-text= subject.name - elsif can?(current_user, :read_build, @project) = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do = render_status_with_link('build', subject.status) - %span.ci-status-text= subject.name + .ci-status-text= subject.name - else = render_status_with_link('build', subject.status) = ci_icon_for_status(subject.status) diff --git a/app/views/projects/commit/_pipeline_grouped_status.html.haml b/app/views/projects/commit/_pipeline_grouped_status.html.haml index 7e02703f0a6..dc8efc83d48 100644 --- a/app/views/projects/commit/_pipeline_grouped_status.html.haml +++ b/app/views/projects/commit/_pipeline_grouped_status.html.haml @@ -3,10 +3,25 @@ .build-content - group_status = CommitStatus.where(id: subject).status = render_status_with_link('build', group_status) - %span.ci-status-text - = name - = subject.length - - // Access all other grouped statuses - //- subject.each do |status| - // = render "projects/#{status.to_partial_path}_pipeline", subject: status + .dropdown.inline + %button.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}} + %span.ci-status-text + = name + %span.badge= subject.length + %ul.dropdown-menu.grouped-pipeline-dropdown + .arrow + - subject.each do |status| + -# = render "projects/#{status.to_partial_path}_pipeline", subject: status + - is_playable = status.playable? && can?(current_user, :update_build, @project) + %li + - if is_playable + = link_to play_namespace_project_build_path(status.project.namespace, status.project, status, return_to: request.original_url), method: :post, title: 'Play' do + = render_status_with_link('build', 'play') + .ci-status-text= status.name + - elsif can?(current_user, :read_build, @project) + = link_to namespace_project_build_path(status.project.namespace, status.project, status) do + = render_status_with_link('build', status.status) + .ci-status-text= status.name + - else + = render_status_with_link('build', status.status) + = ci_icon_for_status(status.status) -- cgit v1.2.3 From 8759770c962f7b6fe509a2d650dd420f75864de6 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 14 Sep 2016 15:03:45 +0200 Subject: Re-use as much of views as possible --- .../projects/ci/builds/_build_pipeline.html.haml | 27 +++++++++++----------- app/views/projects/commit/_pipeline.html.haml | 8 +------ .../commit/_pipeline_grouped_status.html.haml | 27 ---------------------- .../projects/commit/_pipeline_stage.html.haml | 14 +++++++++++ .../commit/_pipeline_status_group.html.haml | 11 +++++++++ .../_generic_commit_status_pipeline.html.haml | 17 ++++++-------- 6 files changed, 46 insertions(+), 58 deletions(-) delete mode 100644 app/views/projects/commit/_pipeline_grouped_status.html.haml create mode 100644 app/views/projects/commit/_pipeline_stage.html.haml create mode 100644 app/views/projects/commit/_pipeline_status_group.html.haml diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml index 5289cd672f5..d19e193c432 100644 --- a/app/views/projects/ci/builds/_build_pipeline.html.haml +++ b/app/views/projects/ci/builds/_build_pipeline.html.haml @@ -1,15 +1,14 @@ - is_playable = subject.playable? && can?(current_user, :update_build, @project) -%li.build{class: ("playable" if is_playable)} - .curve - .build-content - - if is_playable - = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do - = render_status_with_link('build', 'play') - .ci-status-text= subject.name - - elsif can?(current_user, :read_build, @project) - = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do - = render_status_with_link('build', subject.status) - .ci-status-text= subject.name - - else - = render_status_with_link('build', subject.status) - = ci_icon_for_status(subject.status) +- if is_playable + = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do + = render_status_with_link('build', 'play') + .ci-status-text= subject.name +- elsif can?(current_user, :read_build, @project) + = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do + = render_status_with_link('build', subject.status) + .ci-status-text= subject.name +- else + = render_status_with_link('build', subject.status) + = ci_icon_for_status(subject.status) + + diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml index a330c14061f..9258f4b3c25 100644 --- a/app/views/projects/commit/_pipeline.html.haml +++ b/app/views/projects/commit/_pipeline.html.haml @@ -39,13 +39,7 @@ = stage.titleize .builds-container %ul - - status_groups = statuses.group_by(&:group_name) - - status_groups.each do |group_name, grouped_statuses| - - if grouped_statuses.one? - - status = grouped_statuses.first - = render "projects/#{status.to_partial_path}_pipeline", subject: status - - else - = render "projects/commit/pipeline_grouped_status", name: group_name, subject: grouped_statuses + = render "projects/commit/pipeline_stage", statuses: statuses - if pipeline.yaml_errors.present? diff --git a/app/views/projects/commit/_pipeline_grouped_status.html.haml b/app/views/projects/commit/_pipeline_grouped_status.html.haml deleted file mode 100644 index dc8efc83d48..00000000000 --- a/app/views/projects/commit/_pipeline_grouped_status.html.haml +++ /dev/null @@ -1,27 +0,0 @@ -%li.build - .curve - .build-content - - group_status = CommitStatus.where(id: subject).status - = render_status_with_link('build', group_status) - .dropdown.inline - %button.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}} - %span.ci-status-text - = name - %span.badge= subject.length - %ul.dropdown-menu.grouped-pipeline-dropdown - .arrow - - subject.each do |status| - -# = render "projects/#{status.to_partial_path}_pipeline", subject: status - - is_playable = status.playable? && can?(current_user, :update_build, @project) - %li - - if is_playable - = link_to play_namespace_project_build_path(status.project.namespace, status.project, status, return_to: request.original_url), method: :post, title: 'Play' do - = render_status_with_link('build', 'play') - .ci-status-text= status.name - - elsif can?(current_user, :read_build, @project) - = link_to namespace_project_build_path(status.project.namespace, status.project, status) do - = render_status_with_link('build', status.status) - .ci-status-text= status.name - - else - = render_status_with_link('build', status.status) - = ci_icon_for_status(status.status) diff --git a/app/views/projects/commit/_pipeline_stage.html.haml b/app/views/projects/commit/_pipeline_stage.html.haml new file mode 100644 index 00000000000..368564481c4 --- /dev/null +++ b/app/views/projects/commit/_pipeline_stage.html.haml @@ -0,0 +1,14 @@ +- status_groups = statuses.group_by(&:group_name) +- status_groups.each do |group_name, grouped_statuses| + - if grouped_statuses.one? + - status = grouped_statuses.first + - is_playable = status.playable? && can?(current_user, :update_build, @project) + %li.build{class: ("playable" if is_playable)} + .curve + .build-content + = render "projects/#{status.to_partial_path}_pipeline", subject: status + - else + %li.build + .curve + .build-content + = render "projects/commit/pipeline_status_group", name: group_name, subject: grouped_statuses diff --git a/app/views/projects/commit/_pipeline_status_group.html.haml b/app/views/projects/commit/_pipeline_status_group.html.haml new file mode 100644 index 00000000000..03b6249963b --- /dev/null +++ b/app/views/projects/commit/_pipeline_status_group.html.haml @@ -0,0 +1,11 @@ +- group_status = CommitStatus.where(id: subject).status += render_status_with_link('build', group_status) +.dropdown.inline + %button.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}} + %span.ci-status-text + = name + %span.badge= subject.length + %ul.dropdown-menu.grouped-pipeline-dropdown + .arrow + - subject.each do |status| + = render "projects/#{status.to_partial_path}_pipeline", subject: status diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml index 576d0bec51b..9b54c2bc3af 100644 --- a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml +++ b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml @@ -1,10 +1,7 @@ -%li.build - .curve - .build-content - - if subject.target_url - - link_to subject.target_url do - = render_status_with_link('commit status', subject.status) - %span.ci-status-text= subject.name - - else - = render_status_with_link('commit status', subject.status) - %span.ci-status-text= subject.name +- if subject.target_url + - link_to subject.target_url do + = render_status_with_link('commit status', subject.status) + %span.ci-status-text= subject.name +- else + = render_status_with_link('commit status', subject.status) + %span.ci-status-text= subject.name -- cgit v1.2.3 From b964c6c579f57f1ff83eb27caf8ff7f7be6d7671 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 14 Sep 2016 15:04:12 +0200 Subject: Add grouping tests --- app/models/commit_status.rb | 6 +++++- spec/models/commit_status_spec.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index af739342256..1ae1a24c168 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -96,7 +96,7 @@ class CommitStatus < ActiveRecord::Base end def group_name - name.gsub(/\d+[\s:]+\d+\s*/, '') + name.gsub(/\d+[\s:\/\\]+\d+\s*/, '').strip end def self.stages @@ -117,6 +117,10 @@ class CommitStatus < ActiveRecord::Base allow_failure? && (failed? || canceled?) end + def playable? + false + end + def duration calculate_duration end diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index fcfa3138ce5..ea3b8295364 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -223,4 +223,31 @@ describe CommitStatus, models: true do expect(commit_status.commit).to eq project.commit end end + + describe '#group_name' do + subject { commit_status.group_name } + + tests = { + 'rspec:windows' => 'rspec:windows', + 'rspec:windows 0' => 'rspec:windows 0', + 'rspec:windows 0 test' => 'rspec:windows 0 test', + 'rspec:windows 0 1' => 'rspec:windows', + 'rspec:windows 0 1 name' => 'rspec:windows name', + 'rspec:windows 0/1' => 'rspec:windows', + 'rspec:windows 0/1 name' => 'rspec:windows name', + 'rspec:windows 0:1' => 'rspec:windows', + 'rspec:windows 0:1 name' => 'rspec:windows name', + 'rspec:windows 10000 20000' => 'rspec:windows', + 'rspec:windows 0 : / 1' => 'rspec:windows', + 'rspec:windows 0 : / 1 name' => 'rspec:windows name', + } + + tests.each do |name, group_name| + it "'#{name}' puts in '#{group_name}'" do + commit_status.name = name + + is_expected.to eq(group_name) + end + end + end end -- cgit v1.2.3 From d8ba09fca9ac9e0ad55c30686decb1bee7584468 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 14 Sep 2016 15:23:07 +0200 Subject: Add view specs for pipelines graph --- .../projects/pipelines/show.html.haml_spec.rb | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 spec/views/projects/pipelines/show.html.haml_spec.rb diff --git a/spec/views/projects/pipelines/show.html.haml_spec.rb b/spec/views/projects/pipelines/show.html.haml_spec.rb new file mode 100644 index 00000000000..920d7528892 --- /dev/null +++ b/spec/views/projects/pipelines/show.html.haml_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +describe 'projects/pipelines/show' do + include Devise::TestHelpers + + let(:project) { create(:project) } + let(:pipeline) do + create(:ci_empty_pipeline, project: project, + sha: project.commit.id) + end + + before do + create_build('build', 0, 'build') + create_build('test', 1, 'rspec 0 2') + create_build('test', 1, 'rspec 1 2') + create_build('test', 1, 'audit') + create_build('deploy', 2, 'production') + + create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3) + + assign(:project, project) + assign(:pipeline, pipeline) + + allow(view).to receive(:can?).and_return(true) + end + + it 'shows a graph with grouped stages' do + render + + expect(rendered).to have_css('.pipeline-graph') + expect(rendered).to have_css('.grouped-pipeline-dropdown') + + # stages + expect(rendered).to have_text('Build') + expect(rendered).to have_text('Test') + expect(rendered).to have_text('Deploy') + expect(rendered).to have_text('External') + + # builds + expect(rendered).to have_text('rspec') + expect(rendered).to have_text('rspec 0:1') + expect(rendered).to have_text('production') + expect(rendered).to have_text('jenkins') + end + + private + + def create_build(stage, stage_idx, name) + create(:ci_build, pipeline: pipeline, stage: stage, stage_idx: stage_idx, name: name) + end +end -- cgit v1.2.3 From 4e60f79e4027961ed3ec33fc16e2260c660d545a Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 14 Sep 2016 15:25:04 +0200 Subject: Add more regexp tests --- spec/models/commit_status_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb index ea3b8295364..49984fbc5aa 100644 --- a/spec/models/commit_status_spec.rb +++ b/spec/models/commit_status_spec.rb @@ -240,6 +240,8 @@ describe CommitStatus, models: true do 'rspec:windows 10000 20000' => 'rspec:windows', 'rspec:windows 0 : / 1' => 'rspec:windows', 'rspec:windows 0 : / 1 name' => 'rspec:windows name', + '0 1 name ruby' => 'name ruby', + '0 :/ 1 name ruby' => 'name ruby' } tests.each do |name, group_name| -- cgit v1.2.3 From 2f3dc314f42dbd79813e6251792853bc231e69dd Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 14 Sep 2016 16:57:36 +0200 Subject: Fix spec failures --- app/views/projects/ci/builds/_build_pipeline.html.haml | 2 -- app/views/projects/commit/_pipeline_stage.html.haml | 2 +- app/views/projects/commit/_pipeline_status_group.html.haml | 4 ++-- .../_generic_commit_status_pipeline.html.haml | 2 +- spec/views/projects/pipelines/show.html.haml_spec.rb | 13 ++++++------- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml index d19e193c432..547bc0c9c19 100644 --- a/app/views/projects/ci/builds/_build_pipeline.html.haml +++ b/app/views/projects/ci/builds/_build_pipeline.html.haml @@ -10,5 +10,3 @@ - else = render_status_with_link('build', subject.status) = ci_icon_for_status(subject.status) - - diff --git a/app/views/projects/commit/_pipeline_stage.html.haml b/app/views/projects/commit/_pipeline_stage.html.haml index 368564481c4..23c5c51fbc2 100644 --- a/app/views/projects/commit/_pipeline_stage.html.haml +++ b/app/views/projects/commit/_pipeline_stage.html.haml @@ -3,7 +3,7 @@ - if grouped_statuses.one? - status = grouped_statuses.first - is_playable = status.playable? && can?(current_user, :update_build, @project) - %li.build{class: ("playable" if is_playable)} + %li.build{ class: ("playable" if is_playable) } .curve .build-content = render "projects/#{status.to_partial_path}_pipeline", subject: status diff --git a/app/views/projects/commit/_pipeline_status_group.html.haml b/app/views/projects/commit/_pipeline_status_group.html.haml index 03b6249963b..4e7a6f1af08 100644 --- a/app/views/projects/commit/_pipeline_status_group.html.haml +++ b/app/views/projects/commit/_pipeline_status_group.html.haml @@ -1,10 +1,10 @@ - group_status = CommitStatus.where(id: subject).status = render_status_with_link('build', group_status) .dropdown.inline - %button.dropdown-menu-toggle{type: 'button', data: {toggle: 'dropdown'}} + %button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown' } } %span.ci-status-text = name - %span.badge= subject.length + %span.badge= subject.size %ul.dropdown-menu.grouped-pipeline-dropdown .arrow - subject.each do |status| diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml index 9b54c2bc3af..409f4701e4b 100644 --- a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml +++ b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml @@ -1,5 +1,5 @@ - if subject.target_url - - link_to subject.target_url do + = link_to subject.target_url do = render_status_with_link('commit status', subject.status) %span.ci-status-text= subject.name - else diff --git a/spec/views/projects/pipelines/show.html.haml_spec.rb b/spec/views/projects/pipelines/show.html.haml_spec.rb index 920d7528892..c5b16c1c304 100644 --- a/spec/views/projects/pipelines/show.html.haml_spec.rb +++ b/spec/views/projects/pipelines/show.html.haml_spec.rb @@ -4,15 +4,14 @@ describe 'projects/pipelines/show' do include Devise::TestHelpers let(:project) { create(:project) } - let(:pipeline) do - create(:ci_empty_pipeline, project: project, - sha: project.commit.id) - end + let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } before do + controller.prepend_view_path('app/views/projects') + create_build('build', 0, 'build') - create_build('test', 1, 'rspec 0 2') - create_build('test', 1, 'rspec 1 2') + create_build('test', 1, 'rspec 0:2') + create_build('test', 1, 'rspec 1:2') create_build('test', 1, 'audit') create_build('deploy', 2, 'production') @@ -38,7 +37,7 @@ describe 'projects/pipelines/show' do # builds expect(rendered).to have_text('rspec') - expect(rendered).to have_text('rspec 0:1') + expect(rendered).to have_text('rspec 0:2') expect(rendered).to have_text('production') expect(rendered).to have_text('jenkins') end -- cgit v1.2.3