diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-05-06 16:20:20 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-24 12:04:05 +0300 |
commit | 412a38570245003b6509bf20cff2cce206ec8aa7 (patch) | |
tree | 1a2714b97251472f8d0287d49ef65ab76d9f53f9 /spec/serializers | |
parent | 1052f64c3cf90694443487f3485d6f9ae26a5ab8 (diff) |
Do not serialize a deployment commit showing a job
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb index 1edf69dc290..aa0db7bc326 100644 --- a/spec/serializers/build_details_entity_spec.rb +++ b/spec/serializers/build_details_entity_spec.rb @@ -122,5 +122,29 @@ describe BuildDetailsEntity do it { is_expected.to include(failure_reason: 'unmet_prerequisites') } end + + context 'when a build has environment with latest deployment' do + let(:build) do + create(:ci_build, :running, environment: environment.name, pipeline: pipeline) + end + + let(:environment) do + create(:environment, project: project, name: 'staging', state: :available) + end + + before do + create(:deployment, :success, environment: environment, project: project) + + allow(request).to receive(:project).and_return(project) + end + + it 'does not serialize latest deployment commit' do + response = subject.with_indifferent_access + + response.dig(:deployment_status, :environment, :last_deployment).tap do |deployment| + expect(deployment).not_to include(:commit) + end + end + end end end |