diff options
Diffstat (limited to 'spec/serializers/merge_request_poll_widget_entity_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_poll_widget_entity_spec.rb | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/spec/serializers/merge_request_poll_widget_entity_spec.rb b/spec/serializers/merge_request_poll_widget_entity_spec.rb index f0493699209..e5f88e31025 100644 --- a/spec/serializers/merge_request_poll_widget_entity_spec.rb +++ b/spec/serializers/merge_request_poll_widget_entity_spec.rb @@ -36,13 +36,28 @@ RSpec.describe MergeRequestPollWidgetEntity do it 'returns merge_pipeline' do pipeline.reload - pipeline_payload = PipelineDetailsEntity - .represent(pipeline, request: request) - .as_json + pipeline_payload = + MergeRequests::PipelineEntity + .represent(pipeline, request: request) + .as_json expect(subject[:merge_pipeline]).to eq(pipeline_payload) end + context 'when merge_request_short_pipeline_serializer is disabled' do + it 'returns detailed info about pipeline' do + stub_feature_flags(merge_request_short_pipeline_serializer: false) + + pipeline.reload + pipeline_payload = + PipelineDetailsEntity + .represent(pipeline, request: request) + .as_json + + expect(subject[:merge_pipeline]).to eq(pipeline_payload) + end + end + context 'when user cannot read pipelines on target project' do before do project.add_guest(user) @@ -222,13 +237,27 @@ RSpec.describe MergeRequestPollWidgetEntity do let(:req) { double('request', current_user: user, project: project) } it 'returns pipeline' do - pipeline_payload = PipelineDetailsEntity - .represent(pipeline, request: req) - .as_json + pipeline_payload = + MergeRequests::PipelineEntity + .represent(pipeline, request: req) + .as_json expect(subject[:pipeline]).to eq(pipeline_payload) end + context 'when merge_request_short_pipeline_serializer is disabled' do + it 'returns detailed info about pipeline' do + stub_feature_flags(merge_request_short_pipeline_serializer: false) + + pipeline_payload = + PipelineDetailsEntity + .represent(pipeline, request: req) + .as_json + + expect(subject[:pipeline]).to eq(pipeline_payload) + end + end + it 'returns ci_status' do expect(subject[:ci_status]).to eq('pending') end |