Fix remaining specs failures

This commit is contained in:
Kamil Trzcinski 2016-10-18 11:22:22 +02:00
parent e35af6e25e
commit 829a708a97
4 changed files with 14 additions and 7 deletions

View File

@ -412,11 +412,16 @@ class Projects::MergeRequestsController < Projects::ApplicationController
project = environment.project
deployment = environment.first_deployment_for(@merge_request.diff_head_commit)
stop_url =
if environment.stoppable? && can?(current_user, :create_deployment, environment)
stop_namespace_project_environment_path(project.namespace, project, environment)
end
{
id: environment.id,
name: environment.name,
url: namespace_project_environment_path(project.namespace, project, environment),
stop_url: (stop_namespace_project_environment_path(project.namespace, project, environment) if environment.stoppable?),
stop_url: stop_url,
external_url: environment.external_url,
external_url_formatted: environment.formatted_external_url,
deployed_at: deployment.try(:created_at),

View File

@ -23,7 +23,7 @@
New environment
.environments-container
- if @environments.blank?
- if @all_environments.blank?
.blank-state.blank-state-no-icon
%h2.blank-state-title
You don't have any environments right now.

View File

@ -3,7 +3,7 @@
= render "projects/pipelines/head"
%div{ class: container_class }
.top-area
.top-area.adjust
.col-md-9
%h3.page-title= @environment.name.capitalize
.col-md-3

View File

@ -9,9 +9,8 @@ feature 'Widget Deployments Header', feature: true, js: true do
given(:merge_request) { create(:merge_request, :merged) }
given(:environment) { create(:environment, project: project) }
given(:role) { :developer }
given!(:deployment) do
create(:deployment, environment: environment, sha: project.commit('master').id)
end
given(:sha) { project.commit('master').id }
given!(:deployment) { create(:deployment, environment: environment, sha: sha) }
given!(:manual) { }
background do
@ -31,7 +30,10 @@ feature 'Widget Deployments Header', feature: true, js: true do
given(:pipeline) { create(:ci_pipeline, project: project) }
given(:build) { create(:ci_build, pipeline: pipeline) }
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') }
given(:deployment) { create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') }
given(:deployment) do
create(:deployment, environment: environment, ref: merge_request.target_branch,
sha: sha, deployable: build, on_stop: 'close_app')
end
background do
wait_for_ajax