Skip to content

Commit

Permalink
Add specs for Gitaly calls in deployment serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek authored and Filipa Lacerda committed May 24, 2019
1 parent b036033 commit 1052f64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/serializers/build_details_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions spec/controllers/projects/jobs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ def get_index(**extra_params)
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) }
Expand All @@ -262,8 +266,9 @@ def get_index(**extra_params)

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

Expand Down

0 comments on commit 1052f64

Please sign in to comment.