diff options
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/merge_request_poll_cached_widget_entity_spec.rb | 34 | ||||
-rw-r--r-- | spec/serializers/merge_request_poll_widget_entity_spec.rb | 66 |
2 files changed, 34 insertions, 66 deletions
diff --git a/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb b/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb index cad3d2e3373..acb9cd4878c 100644 --- a/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb +++ b/spec/serializers/merge_request_poll_cached_widget_entity_spec.rb @@ -313,4 +313,38 @@ RSpec.describe MergeRequestPollCachedWidgetEntity do end end end + + describe 'ci related paths' do + using RSpec::Parameterized::TableSyntax + + where(:path_field, :method_for_existence_check) do + :terraform_reports_path | :has_terraform_reports? + :accessibility_report_path | :has_accessibility_reports? + :exposed_artifacts_path | :has_exposed_artifacts? + :test_reports_path | :has_test_reports? + :codequality_reports_path | :has_codequality_reports? + end + + with_them do + context 'when merge request has reports' do + before do + allow(resource).to receive(method_for_existence_check).and_return(true) + end + + it 'set the path to poll data' do + expect(subject[path_field]).to be_present + end + end + + context 'when merge request has no reports' do + before do + allow(resource).to receive(method_for_existence_check).and_return(false) + end + + it 'does not set reports path' do + expect(subject[path_field]).to be_nil + end + end + end + end end diff --git a/spec/serializers/merge_request_poll_widget_entity_spec.rb b/spec/serializers/merge_request_poll_widget_entity_spec.rb index 366211731cc..c88555226a9 100644 --- a/spec/serializers/merge_request_poll_widget_entity_spec.rb +++ b/spec/serializers/merge_request_poll_widget_entity_spec.rb @@ -87,72 +87,6 @@ RSpec.describe MergeRequestPollWidgetEntity do end end - describe 'terraform_reports_path' do - context 'when merge request has terraform reports' do - before do - allow(resource).to receive(:has_terraform_reports?).and_return(true) - end - - it 'set the path to poll data' do - expect(subject[:terraform_reports_path]).to be_present - end - end - - context 'when merge request has no terraform reports' do - before do - allow(resource).to receive(:has_terraform_reports?).and_return(false) - end - - it 'set the path to poll data' do - expect(subject[:terraform_reports_path]).to be_nil - end - end - end - - describe 'accessibility_report_path' do - context 'when merge request has accessibility reports' do - before do - allow(resource).to receive(:has_accessibility_reports?).and_return(true) - end - - it 'set the path to poll data' do - expect(subject[:accessibility_report_path]).to be_present - end - end - - context 'when merge request has no accessibility reports' do - before do - allow(resource).to receive(:has_accessibility_reports?).and_return(false) - end - - it 'set the path to poll data' do - expect(subject[:accessibility_report_path]).to be_nil - end - end - end - - describe 'exposed_artifacts_path' do - context 'when merge request has exposed artifacts' do - before do - expect(resource).to receive(:has_exposed_artifacts?).and_return(true) - end - - it 'set the path to poll data' do - expect(subject[:exposed_artifacts_path]).to be_present - end - end - - context 'when merge request has no exposed artifacts' do - before do - expect(resource).to receive(:has_exposed_artifacts?).and_return(false) - end - - it 'set the path to poll data' do - expect(subject[:exposed_artifacts_path]).to be_nil - end - end - end - describe 'auto merge' do before do project.add_maintainer(user) |