Changes after review

Fix error
This commit is contained in:
Filipa Lacerda 2016-12-07 10:34:00 +00:00
parent 19e1b3246d
commit 2dc907bc17
3 changed files with 11 additions and 13 deletions

View File

@ -14,16 +14,14 @@ module EnvironmentHelper
end
end
def deployment_link(deployment)
def deployment_link(deployment, text)
return unless deployment
link_to "##{deployment.iid}", [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
end
def last_deployment_link(deployment, link_text)
return unless deployment
link_to link_text, [deployment.project.namespace.becomes(Namespace), deployment.project, deployment.deployable]
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]
end
end
def last_deployment_link_for_environment_build(project, build)

View File

@ -46,7 +46,7 @@
- else
This build is creating a deployment to #{environment_link_for_build(@build.project, @build)}
- 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
- if @build.erased?

View File

@ -228,8 +228,8 @@ feature 'Builds', :feature do
end
end
context 'When build starts environment' do
context 'Build is successfull and has deployment' do
context 'when build starts environment' do
context 'build is successfull and has deployment' do
it 'shows a link for the build' do
environment = create(:environment, project: project)
pipeline = create(:ci_pipeline, project: project)
@ -242,7 +242,7 @@ feature 'Builds', :feature do
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
environment = create(:environment, project: project)
pipeline = create(:ci_pipeline, project: project)
@ -254,7 +254,7 @@ feature 'Builds', :feature do
end
end
context 'Build creates a new deployment' do
context 'build creates a new deployment' do
it 'shows a link to lastest deployment' do
environment = create(:environment, project: project)
create(:deployment, environment: environment, sha: project.commit.id)