diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-26 15:10:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-26 15:10:14 +0300 |
commit | ee0b7522d90ace2053f1d8dfcdf6b01d50179ed1 (patch) | |
tree | 06d525028469d48ad828a67e9fb98b1080d7685f /spec/helpers | |
parent | d79bf171e4bcbb551a8320211ee337368b4d114c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/projects_helper_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index b7cc8c217a4..b443ebff552 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -1313,4 +1313,38 @@ RSpec.describe ProjectsHelper do end end end + + describe '#project_coverage_chart_data_attributes' do + let(:ref) { 'ref' } + let(:daily_coverage_options) do + { + base_params: { + start_date: Date.current - 90.days, + end_date: Date.current, + ref_path: project.repository.expand_ref(ref), + param_type: 'coverage' + }, + download_path: namespace_project_ci_daily_build_group_report_results_path( + namespace_id: project.namespace, + project_id: project, + format: :csv + ), + graph_api_path: namespace_project_ci_daily_build_group_report_results_path( + namespace_id: project.namespace, + project_id: project, + format: :json + ) + } + end + + it 'returns project data to render coverage chart' do + expect(helper.project_coverage_chart_data_attributes(daily_coverage_options, ref)).to include( + graph_endpoint: start_with(daily_coverage_options.fetch(:graph_api_path)), + graph_start_date: daily_coverage_options.dig(:base_params, :start_date).strftime('%b %d'), + graph_end_date: daily_coverage_options.dig(:base_params, :end_date).strftime('%b %d'), + graph_ref: ref, + graph_csv_path: start_with(daily_coverage_options.fetch(:download_path)) + ) + end + end end |