diff options
Diffstat (limited to 'spec/serializers/merge_request_poll_cached_widget_entity_spec.rb')
-rw-r--r-- | spec/serializers/merge_request_poll_cached_widget_entity_spec.rb | 34 |
1 files changed, 34 insertions, 0 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 |