summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2016-10-06 18:10:18 +0100
committerFilipa Lacerda <filipa@gitlab.com>2016-10-06 18:10:18 +0100
commit8443cee049068d8d69633e57df5e15e6d999f073 (patch)
tree0df24efb4085457df6b72db182be927ab9a50913
parentf7303dd669765745729d947f7fc410230d17c35c (diff)
downloadgitlab-ce-8443cee049068d8d69633e57df5e15e6d999f073.tar.gz
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
-rw-r--r--app/views/projects/deployments/_actions.haml2
-rw-r--r--spec/features/environments_spec.rb18
2 files changed, 19 insertions, 1 deletions
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