summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-05-06 13:41:52 +0200
committerFilipa Lacerda <filipa@gitlab.com>2019-05-24 10:04:05 +0100
commit1052f64c3cf90694443487f3485d6f9ae26a5ab8 (patch)
tree2f8df036635bfea4ec2389e73d7ce7deca9775b3
parentb0360335dcca34b2028b80febfb4a6221dc79967 (diff)
downloadgitlab-ce-1052f64c3cf90694443487f3485d6f9ae26a5ab8.tar.gz
Add specs for Gitaly calls in deployment serialization
-rw-r--r--app/serializers/build_details_entity.rb1
-rw-r--r--spec/controllers/projects/jobs_controller_spec.rb9
2 files changed, 7 insertions, 3 deletions
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb
index 61420ce0219..30c3246b05b 100644
--- a/app/serializers/build_details_entity.rb
+++ b/app/serializers/build_details_entity.rb
@@ -13,7 +13,6 @@ class BuildDetailsEntity < JobEntity
expose :deployment_status, if: -> (*) { build.starts_environment? } do
expose :deployment_status, as: :status
-
expose :persisted_environment, as: :environment, with: EnvironmentEntity
end
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb
index 21cbd498744..f467d13cfd5 100644
--- a/spec/controllers/projects/jobs_controller_spec.rb
+++ b/spec/controllers/projects/jobs_controller_spec.rb
@@ -253,6 +253,10 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
context 'with deployment' do
+ before do
+ create(:deployment, :success, environment: environment, project: project)
+ end
+
let(:merge_request) { create(:merge_request, source_project: project) }
let(:environment) { create(:environment, project: project, name: 'staging', state: :available) }
let(:job) { create(:ci_build, :running, environment: environment.name, pipeline: pipeline) }
@@ -262,8 +266,9 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('job/job_details')
- expect(json_response['deployment_status']["status"]).to eq 'creating'
- expect(json_response['deployment_status']["environment"]).not_to be_nil
+ expect(json_response.dig('deployment_status', 'status')).to eq 'creating'
+ expect(json_response.dig('deployment_status', 'environment')).not_to be_nil
+ expect(json_response.dig('deployment_status', 'environment', 'last_deployment')).not_to be_nil
end
end