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
This commit is contained in:
Filipa Lacerda 2016-10-06 18:10:18 +01:00
parent f7303dd669
commit 8443cee049
2 changed files with 19 additions and 1 deletions

View File

@ -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')

View File

@ -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