summaryrefslogtreecommitdiff
path: root/spec/helpers/projects_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/helpers/projects_helper_spec.rb
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/helpers/projects_helper_spec.rb')
-rw-r--r--spec/helpers/projects_helper_spec.rb39
1 files changed, 38 insertions, 1 deletions
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
index b7cc8c217a4..04c066986b7 100644
--- a/spec/helpers/projects_helper_spec.rb
+++ b/spec/helpers/projects_helper_spec.rb
@@ -966,7 +966,10 @@ RSpec.describe ProjectsHelper do
operationsAccessLevel: project.project_feature.operations_access_level,
showDefaultAwardEmojis: project.show_default_award_emojis?,
securityAndComplianceAccessLevel: project.security_and_compliance_access_level,
- containerRegistryAccessLevel: project.project_feature.container_registry_access_level
+ containerRegistryAccessLevel: project.project_feature.container_registry_access_level,
+ environmentsAccessLevel: project.project_feature.environments_access_level,
+ featureFlagsAccessLevel: project.project_feature.feature_flags_access_level,
+ releasesAccessLevel: project.project_feature.releases_access_level
)
end
@@ -1313,4 +1316,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