diff --git a/ee/app/helpers/ee/merge_requests_helper.rb b/ee/app/helpers/ee/merge_requests_helper.rb index 18ae1320c2bd4d408b1a2a914dec1d24ec49ff4d..743b644fd4a040706d0978a51fc0c2ad373f565d 100644 --- a/ee/app/helpers/ee/merge_requests_helper.rb +++ b/ee/app/helpers/ee/merge_requests_helper.rb @@ -25,7 +25,7 @@ def diffs_tab_pane_data(project, merge_request, params) show_generate_test_file_button: ::Llm::GenerateTestFileService.new(current_user, merge_request).valid?.to_s } - data[:endpoint_sast] = (security_reports_project_merge_request_path(project, merge_request, type: :sast) if merge_request.has_sast_reports?) if ::Feature.enabled?(:sast_reports_in_inline_diff, project) + data[:sast_report_available] = merge_request.has_sast_reports?.to_s if ::Feature.enabled?(:sast_reports_in_inline_diff, project) super.merge(data) end diff --git a/ee/spec/helpers/merge_requests_helper_spec.rb b/ee/spec/helpers/merge_requests_helper_spec.rb index f9e03679fcd9a2b34c56d9a06a483cf8258b1a19..56685e4663c5ea460a00cb9e0db60f2b19b7e2df 100644 --- a/ee/spec/helpers/merge_requests_helper_spec.rb +++ b/ee/spec/helpers/merge_requests_helper_spec.rb @@ -55,15 +55,23 @@ end end - context 'for endpoint_sast' do + context 'for sast_report_available' do before do allow(merge_request).to receive(:has_sast_reports?).and_return(true) end it 'returns expected value' do - expect( - subject[:endpoint_sast] - ).to eq("/#{project.full_path}/-/merge_requests/#{merge_request.iid}/security_reports?type=sast") + expect(subject[:sast_report_available]).to eq('true') + end + + context 'when merge request does not have SAST reports' do + before do + allow(merge_request).to receive(:has_sast_reports?).and_return(false) + end + + it 'returns expected value' do + expect(subject[:sast_report_available]).to eq('false') + end end context 'when feature flag is disabled' do @@ -71,8 +79,8 @@ stub_feature_flags(sast_reports_in_inline_diff: false) end - it 'does not return endpoint' do - expect(subject).not_to have_key(:endpoint_sast) + it 'does not return the variable' do + expect(subject).not_to have_key(:sast_report_available) end end end