diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/support/helpers/metrics_dashboard_helpers.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/support/helpers/metrics_dashboard_helpers.rb')
-rw-r--r-- | spec/support/helpers/metrics_dashboard_helpers.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/support/helpers/metrics_dashboard_helpers.rb b/spec/support/helpers/metrics_dashboard_helpers.rb index b2dd8ead7dd..7168079fead 100644 --- a/spec/support/helpers/metrics_dashboard_helpers.rb +++ b/spec/support/helpers/metrics_dashboard_helpers.rb @@ -1,16 +1,22 @@ # frozen_string_literal: true module MetricsDashboardHelpers - def project_with_dashboard(dashboard_path, dashboard_yml = nil) - dashboard_yml ||= fixture_file('lib/gitlab/metrics/dashboard/sample_dashboard.yml') - - create(:project, :custom_repo, files: { dashboard_path => dashboard_yml }) + # @param dashboards [Hash<string, string>] - Should contain a hash where + # each key is the path to a dashboard in the repository and each value is + # the dashboard content. + # Ex: { '.gitlab/dashboards/dashboard1.yml' => fixture_file('lib/gitlab/metrics/dashboard/sample_dashboard.yml') } + def project_with_dashboards(dashboards, project_params = {}) + create(:project, :custom_repo, **project_params, files: dashboards) end - def project_with_dashboard_namespace(dashboard_path, dashboard_yml = nil) + def project_with_dashboard(dashboard_path, dashboard_yml = nil, project_params = {}) dashboard_yml ||= fixture_file('lib/gitlab/metrics/dashboard/sample_dashboard.yml') - create(:project, :custom_repo, namespace: namespace, path: 'monitor-project', files: { dashboard_path => dashboard_yml }) + project_with_dashboards({ dashboard_path => dashboard_yml }, project_params) + end + + def project_with_dashboard_namespace(dashboard_path, dashboard_yml = nil, project_params = {}) + project_with_dashboard(dashboard_path, dashboard_yml, project_params.reverse_merge(path: 'monitor-project')) end def delete_project_dashboard(project, user, dashboard_path) |