From 8443cee049068d8d69633e57df5e15e6d999f073 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 6 Oct 2016 18:10:18 +0100 Subject: [PATCH] Fixes external_url link Adds tests for: - external_url link in environmnets list - must show deployment internal id in environments list - must show build name and id in environments list --- app/views/projects/deployments/_actions.haml | 2 +- spec/features/environments_spec.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/views/projects/deployments/_actions.haml b/app/views/projects/deployments/_actions.haml index 9fd97a7d753..8cb0b5825e0 100644 --- a/app/views/projects/deployments/_actions.haml +++ b/app/views/projects/deployments/_actions.haml @@ -1,7 +1,7 @@ - if can?(current_user, :create_deployment, deployment) && deployment.deployable .pull-right - - external_url = deployment.deployable.try(:external_url) + - external_url = deployment.environment.try(:external_url) - if external_url = link_to external_url, target: '_blank', class: 'btn external-url' do = icon('external-link') diff --git a/spec/features/environments_spec.rb b/spec/features/environments_spec.rb index 4309a726917..d4ecccf5f12 100644 --- a/spec/features/environments_spec.rb +++ b/spec/features/environments_spec.rb @@ -44,6 +44,10 @@ feature 'Environments', feature: true do scenario 'does show deployment SHA' do expect(page).to have_link(deployment.short_sha) end + + scenario 'does show deployment internal id' do + expect(page).to have_content(deployment.iid) + end context 'with build and manual actions' do given(:pipeline) { create(:ci_pipeline, project: project) } @@ -61,6 +65,20 @@ feature 'Environments', feature: true do expect(page).to have_content(manual.name) expect(manual.reload).to be_pending end + + scenario 'does show build name and id' do + expect(page).to have_link("#{build.name} (##{build.id})") + end + + context 'with external_url' do + given(:environment) { create(:environment, project: project, external_url: 'https://git.gitlab.com') } + given(:build) { create(:ci_build, pipeline: pipeline) } + given(:deployment) { create(:deployment, environment: environment, deployable: build) } + + scenario 'does show an external link button' do + expect(page).to have_selector('.btn.external-url') + end + end end end end