Commit 9ed7171a authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Fix builds/show spec; use iid instead of id

parent 43906336
...@@ -17,7 +17,7 @@ module EnvironmentHelper ...@@ -17,7 +17,7 @@ module EnvironmentHelper
def deployment_link(deployment) def deployment_link(deployment)
return unless 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 end
def last_deployment_link_for_environment_build(project, build) def last_deployment_link_for_environment_build(project, build)
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
- if environment.last_deployment - if environment.last_deployment
View the most recent deployment #{deployment_link(environment.last_deployment)}. View the most recent deployment #{deployment_link(environment.last_deployment)}.
- elsif @build.complete? && !@build.success? - 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 - else
This build is creating a deployment to #{environment_link_for_build(@build.project, @build)} This build is creating a deployment to #{environment_link_for_build(@build.project, @build)}
- if environment.last_deployment - if environment.last_deployment
......
...@@ -40,6 +40,10 @@ describe 'projects/builds/show', :view do ...@@ -40,6 +40,10 @@ describe 'projects/builds/show', :view do
create(:ci_build, :success, environment: 'staging', pipeline: pipeline) create(:ci_build, :success, environment: 'staging', pipeline: pipeline)
end end
let(:second_build) do
create(:ci_build, :success, environment: 'staging', pipeline: pipeline)
end
let(:environment) do let(:environment) do
create(:environment, name: 'staging', project: project) create(:environment, name: 'staging', project: project)
end end
...@@ -49,12 +53,12 @@ describe 'projects/builds/show', :view do ...@@ -49,12 +53,12 @@ describe 'projects/builds/show', :view do
end end
let!(:second_deployment) do let!(:second_deployment) do
create(:deployment, environment: environment, deployable: build) create(:deployment, environment: environment, deployable: second_build)
end end
it 'shows deployment message' do it 'shows deployment message' do
expected_text = 'This build is an out-of-date deployment ' \ 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 render
expect(rendered).to have_css('.environment-information', text: expected_text) expect(rendered).to have_css('.environment-information', text: expected_text)
...@@ -71,7 +75,7 @@ describe 'projects/builds/show', :view do ...@@ -71,7 +75,7 @@ describe 'projects/builds/show', :view do
end end
it 'shows deployment message' do 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 render
expect(rendered).to have_css( expect(rendered).to have_css(
...@@ -107,7 +111,7 @@ describe 'projects/builds/show', :view do ...@@ -107,7 +111,7 @@ describe 'projects/builds/show', :view do
end end
it 'shows deployment message' do 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 render
expect(rendered).to have_css( expect(rendered).to have_css(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment