Commit 2dc907bc authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

Fix error
parent 19e1b324
...@@ -14,16 +14,14 @@ module EnvironmentHelper ...@@ -14,16 +14,14 @@ module EnvironmentHelper
end end
end end
def deployment_link(deployment) def deployment_link(deployment, text)
return unless deployment return unless deployment
if text
link_to text, [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
else
link_to "##{deployment.iid}", [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(deployment, link_text)
return unless deployment
link_to link_text, [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)
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
- 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.try(:last_deployment) - if environment.try(:last_deployment)
and will overwrite the #{last_deployment_link(environment.last_deployment, 'latest deployment')} and will overwrite the #{deployment_link(environment.last_deployment, 'latest deployment')}
.prepend-top-default .prepend-top-default
- if @build.erased? - if @build.erased?
......
...@@ -228,8 +228,8 @@ feature 'Builds', :feature do ...@@ -228,8 +228,8 @@ feature 'Builds', :feature do
end end
end end
context 'When build starts environment' do context 'when build starts environment' do
context 'Build is successfull and has deployment' do context 'build is successfull and has deployment' do
it 'shows a link for the build' do it 'shows a link for the build' do
environment = create(:environment, project: project) environment = create(:environment, project: project)
pipeline = create(:ci_pipeline, project: project) pipeline = create(:ci_pipeline, project: project)
...@@ -242,7 +242,7 @@ feature 'Builds', :feature do ...@@ -242,7 +242,7 @@ feature 'Builds', :feature do
end end
end end
context 'Build is complete and not successfull' do context 'build is complete and not successfull' do
it 'shows a link for the build' do it 'shows a link for the build' do
environment = create(:environment, project: project) environment = create(:environment, project: project)
pipeline = create(:ci_pipeline, project: project) pipeline = create(:ci_pipeline, project: project)
...@@ -254,7 +254,7 @@ feature 'Builds', :feature do ...@@ -254,7 +254,7 @@ feature 'Builds', :feature do
end end
end end
context 'Build creates a new deployment' do context 'build creates a new deployment' do
it 'shows a link to lastest deployment' do it 'shows a link to lastest deployment' do
environment = create(:environment, project: project) environment = create(:environment, project: project)
create(:deployment, environment: environment, sha: project.commit.id) create(:deployment, environment: environment, sha: project.commit.id)
......
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