Commit 2b8292cd authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Finish specs for environment info

parent d7ba85c7
...@@ -38,19 +38,14 @@ ...@@ -38,19 +38,14 @@
- if @build.complete? - if @build.complete?
- if @build.success? - if @build.success?
- if last_deployment.try(:last?) - if last_deployment.try(:last?)
This build is the most recent deployment to This build is the most recent deployment to #{environment_link_for_build(@build.project, @build)}.
= environment_link_for_build(@build.project, @build)
- else - else
This build is an out-of-date deployment to #{environment_link_for_build(@build.project, @build)}. View the most recent deployment #{deployment_link(@project, last_deployment)}. This build is an out-of-date deployment to #{environment_link_for_build(@build.project, @build)}. View the most recent deployment #{deployment_link(@project, last_deployment)}.
- else - else
The deployment of this build to The deployment of this build to #{environment_link_for_build(@build.project, @build)} did not complete.
= environment_link_for_build(@build.project, @build)
did not complete.
- else - else
This build is creating a deployment to This build is creating a deployment to #{environment_link_for_build(@build.project, @build)} and will overwrite the |
= environment_link_for_build(@build.project, @build) = link_to "latest deployment.", deployment_link(@project, last_deployment) |
and will overwrite the
= link_to "latest deployment.", deployment_link(@project, last_deployment)
.prepend-top-default .prepend-top-default
- if @build.erased? - if @build.erased?
......
...@@ -28,7 +28,6 @@ describe 'projects/builds/show', :view do ...@@ -28,7 +28,6 @@ describe 'projects/builds/show', :view do
it 'shows deployment message' do it 'shows deployment message' do
expected_text = 'This build is the most recent deployment' expected_text = 'This build is the most recent deployment'
render render
expect(rendered).to have_css( expect(rendered).to have_css(
...@@ -63,22 +62,75 @@ describe 'projects/builds/show', :view do ...@@ -63,22 +62,75 @@ describe 'projects/builds/show', :view do
end end
context 'build failed to deploy' do context 'build failed to deploy' do
let(:build) { create(:ci_build, :failed, environment: 'staging') } let(:build) do
let!(:environment) { create(:environment, name: 'staging') } create(:ci_build, :failed, environment: 'staging', pipeline: pipeline)
end
let!(:environment) do
create(:environment, name: 'staging', project: project)
end
it 'shows deployment message' do
expected_text = 'The deployment of this build to staging did not complete.'
render
expect(rendered).to have_css(
'.environment-information', text: expected_text)
end
end end
context 'build will deploy' do context 'build will deploy' do
let(:build) { create(:ci_build, :running, environment: 'staging') } let(:build) do
let!(:environment) { create(:environment, name: 'staging') } create(:ci_build, :running, environment: 'staging', pipeline: pipeline)
end
let!(:environment) do
create(:environment, name: 'staging', project: project)
end
it 'shows deployment message' do
expected_text = 'This build is creating a deployment to staging'
render
expect(rendered).to have_css(
'.environment-information', text: expected_text)
end
end end
context 'build that failed to deploy and environment has not been created' do context 'build that failed to deploy and environment has not been created' do
let(:build) { create(:ci_build, :failed, environment: 'staging') } let(:build) do
create(:ci_build, :failed, environment: 'staging', pipeline: pipeline)
end
let!(:environment) do
create(:environment, name: 'staging', project: project)
end
it 'shows deployment message' do
expected_text = 'The deployment of this build to staging did not complete'
render
expect(rendered).to have_css(
'.environment-information', text: expected_text)
end
end end
context 'build that will deploy and environment has not been created' do context 'build that will deploy and environment has not been created' do
let(:build) { create(:ci_build, :running, environment: 'staging') } let(:build) do
let!(:environment) { create(:environment, name: 'staging') } create(:ci_build, :running, environment: 'staging', pipeline: pipeline)
end
let!(:environment) do
create(:environment, name: 'staging', project: project)
end
it 'shows deployment message' do
expected_text = 'This build is creating a deployment to staging'
render
expect(rendered).to have_css(
'.environment-information', text: expected_text)
end
end end
end end
......
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