diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-05-06 17:30:57 +0200 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-24 10:04:05 +0100 |
commit | de24df98a3a20f87f5fed513d27a20b6238d6959 (patch) | |
tree | 56d19ee9c2e15e946c3f7c0962c0a062a64565c6 /spec/serializers | |
parent | 412a38570245003b6509bf20cff2cce206ec8aa7 (diff) | |
download | gitlab-ce-de24df98a3a20f87f5fed513d27a20b6238d6959.tar.gz |
Do not serialize deployment details for build details page
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 4 | ||||
-rw-r--r-- | spec/serializers/deployment_entity_spec.rb | 32 |
2 files changed, 34 insertions, 2 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb index aa0db7bc326..68cf428ed38 100644 --- a/spec/serializers/build_details_entity_spec.rb +++ b/spec/serializers/build_details_entity_spec.rb @@ -138,11 +138,11 @@ describe BuildDetailsEntity do allow(request).to receive(:project).and_return(project) end - it 'does not serialize latest deployment commit' do + it 'does not serialize latest deployment commit and associated builds' do response = subject.with_indifferent_access response.dig(:deployment_status, :environment, :last_deployment).tap do |deployment| - expect(deployment).not_to include(:commit) + expect(deployment).not_to include(:commit, :deployable, :manual_actions, :scheduled_actions) end end end diff --git a/spec/serializers/deployment_entity_spec.rb b/spec/serializers/deployment_entity_spec.rb index 894fd7a0a12..f0bbf90c6c6 100644 --- a/spec/serializers/deployment_entity_spec.rb +++ b/spec/serializers/deployment_entity_spec.rb @@ -10,6 +10,7 @@ describe DeploymentEntity do let(:build) { create(:ci_build, :manual, pipeline: pipeline) } let(:pipeline) { create(:ci_pipeline, project: project, user: user) } let(:entity) { described_class.new(deployment, request: request) } + subject { entity.as_json } before do @@ -47,6 +48,16 @@ describe DeploymentEntity do expect(subject[:manual_actions]).not_to be_present end end + + context 'when deployment details serialization was disabled' do + let(:entity) do + described_class.new(deployment, request: request, deployment_details: false) + end + + it 'does not serialize manual actions details' do + expect(subject.with_indifferent_access).not_to include(:manual_actions) + end + end end describe 'scheduled_actions' do @@ -69,5 +80,26 @@ describe DeploymentEntity do expect(subject[:scheduled_actions]).to be_empty end end + + context 'when deployment details serialization was disabled' do + let(:entity) do + described_class.new(deployment, request: request, deployment_details: false) + end + + it 'does not serialize scheduled actions details' do + expect(subject.with_indifferent_access).not_to include(:scheduled_actions) + end + end + end + + context 'when deployment details serialization was disabled' do + let(:entity) do + described_class.new(deployment, request: request, deployment_details: false) + end + + it 'does not serialize deployment details' do + expect(subject.with_indifferent_access) + .not_to include(:commit, :deployable, :manual_actions, :scheduled_actions) + end end end |