Commit 829a708a authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix remaining specs failures

parent e35af6e2
...@@ -412,11 +412,16 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -412,11 +412,16 @@ class Projects::MergeRequestsController < Projects::ApplicationController
project = environment.project project = environment.project
deployment = environment.first_deployment_for(@merge_request.diff_head_commit) 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, id: environment.id,
name: environment.name, name: environment.name,
url: namespace_project_environment_path(project.namespace, project, environment), 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: environment.external_url,
external_url_formatted: environment.formatted_external_url, external_url_formatted: environment.formatted_external_url,
deployed_at: deployment.try(:created_at), deployed_at: deployment.try(:created_at),
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
New environment New environment
.environments-container .environments-container
- if @environments.blank? - if @all_environments.blank?
.blank-state.blank-state-no-icon .blank-state.blank-state-no-icon
%h2.blank-state-title %h2.blank-state-title
You don't have any environments right now. You don't have any environments right now.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= render "projects/pipelines/head" = render "projects/pipelines/head"
%div{ class: container_class } %div{ class: container_class }
.top-area .top-area.adjust
.col-md-9 .col-md-9
%h3.page-title= @environment.name.capitalize %h3.page-title= @environment.name.capitalize
.col-md-3 .col-md-3
......
...@@ -9,9 +9,8 @@ feature 'Widget Deployments Header', feature: true, js: true do ...@@ -9,9 +9,8 @@ feature 'Widget Deployments Header', feature: true, js: true do
given(:merge_request) { create(:merge_request, :merged) } given(:merge_request) { create(:merge_request, :merged) }
given(:environment) { create(:environment, project: project) } given(:environment) { create(:environment, project: project) }
given(:role) { :developer } given(:role) { :developer }
given!(:deployment) do given(:sha) { project.commit('master').id }
create(:deployment, environment: environment, sha: project.commit('master').id) given!(:deployment) { create(:deployment, environment: environment, sha: sha) }
end
given!(:manual) { } given!(:manual) { }
background do background do
...@@ -31,7 +30,10 @@ feature 'Widget Deployments Header', feature: true, js: true do ...@@ -31,7 +30,10 @@ feature 'Widget Deployments Header', feature: true, js: true do
given(:pipeline) { create(:ci_pipeline, project: project) } given(:pipeline) { create(:ci_pipeline, project: project) }
given(:build) { create(:ci_build, pipeline: pipeline) } given(:build) { create(:ci_build, pipeline: pipeline) }
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') } 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 background do
wait_for_ajax wait_for_ajax
......
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