Commit 1052f64c authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Filipa Lacerda

Add specs for Gitaly calls in deployment serialization

parent b0360335
......@@ -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
......
......@@ -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
......
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