Fix builds/show spec; use iid instead of id

This commit is contained in:
Annabel Dunstone Gray 2016-11-17 13:33:53 -06:00
parent 43906336ff
commit 9ed7171a6a
3 changed files with 10 additions and 6 deletions

View file

@ -17,7 +17,7 @@ module EnvironmentHelper
def deployment_link(deployment)
return unless deployment
link_to "##{deployment.id}", [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
link_to "##{deployment.iid}", [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
end
def last_deployment_link_for_environment_build(project, build)

View file

@ -43,7 +43,7 @@
- if environment.last_deployment
View the most recent deployment #{deployment_link(environment.last_deployment)}.
- elsif @build.complete? && !@build.success?
The deployment of this build to #{environment_link_for_build(@build.project, @build)} did not complete.
The deployment of this build to #{environment_link_for_build(@build.project, @build)} did not succeed.
- else
This build is creating a deployment to #{environment_link_for_build(@build.project, @build)}
- if environment.last_deployment

View file

@ -40,6 +40,10 @@ describe 'projects/builds/show', :view do
create(:ci_build, :success, environment: 'staging', pipeline: pipeline)
end
let(:second_build) do
create(:ci_build, :success, environment: 'staging', pipeline: pipeline)
end
let(:environment) do
create(:environment, name: 'staging', project: project)
end
@ -49,12 +53,12 @@ describe 'projects/builds/show', :view do
end
let!(:second_deployment) do
create(:deployment, environment: environment, deployable: build)
create(:deployment, environment: environment, deployable: second_build)
end
it 'shows deployment message' do
expected_text = 'This build is an out-of-date deployment ' \
"to staging.\nView the most recent deployment ##{second_deployment.id}."
"to staging.\nView the most recent deployment ##{second_deployment.iid}."
render
expect(rendered).to have_css('.environment-information', text: expected_text)
@ -71,7 +75,7 @@ describe 'projects/builds/show', :view do
end
it 'shows deployment message' do
expected_text = 'The deployment of this build to staging did not complete.'
expected_text = 'The deployment of this build to staging did not succeed.'
render
expect(rendered).to have_css(
@ -107,7 +111,7 @@ describe 'projects/builds/show', :view do
end
it 'shows deployment message' do
expected_text = 'The deployment of this build to staging did not complete'
expected_text = 'The deployment of this build to staging did not succeed'
render
expect(rendered).to have_css(