diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-12 15:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-12 15:09:47 +0300 |
commit | ef7cfec30c9fab7b9e757877c472ca7ca2eccc2d (patch) | |
tree | f69647e6f64c16fad044d564db65cb51c7a0b63f /spec/controllers | |
parent | 0e1a6f6a2b28464e6ad151da4dced6d603bd11b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/concerns/metrics_dashboard_spec.rb | 29 | ||||
-rw-r--r-- | spec/controllers/projects/issues_controller_spec.rb | 3 |
2 files changed, 31 insertions, 1 deletions
diff --git a/spec/controllers/concerns/metrics_dashboard_spec.rb b/spec/controllers/concerns/metrics_dashboard_spec.rb index 4e42171e3d3..3a6a037ac9a 100644 --- a/spec/controllers/concerns/metrics_dashboard_spec.rb +++ b/spec/controllers/concerns/metrics_dashboard_spec.rb @@ -114,6 +114,35 @@ describe MetricsDashboard do end end end + + context 'starred dashboards' do + let_it_be(:dashboard_yml) { fixture_file('lib/gitlab/metrics/dashboard/sample_dashboard.yml') } + let_it_be(:dashboards) do + { + '.gitlab/dashboards/test.yml' => dashboard_yml, + '.gitlab/dashboards/anomaly.yml' => dashboard_yml, + '.gitlab/dashboards/errors.yml' => dashboard_yml + } + end + let_it_be(:project) { create(:project, :custom_repo, files: dashboards) } + + before do + create(:metrics_users_starred_dashboard, user: user, project: project, dashboard_path: '.gitlab/dashboards/errors.yml') + create(:metrics_users_starred_dashboard, user: user, project: project, dashboard_path: '.gitlab/dashboards/test.yml') + end + + it 'adds starred dashboard information and sorts the list' do + all_dashboards = json_response['all_dashboards'].map { |dashboard| dashboard.slice('display_name', 'starred', 'user_starred_path') } + expected_response = [ + { "display_name" => "errors.yml", "starred" => true, 'user_starred_path' => nil }, + { "display_name" => "test.yml", "starred" => true, 'user_starred_path' => nil }, + { "display_name" => "anomaly.yml", "starred" => false, 'user_starred_path' => nil }, + { "display_name" => "Default", "starred" => false, 'user_starred_path' => nil } + ] + + expect(all_dashboards).to eql expected_response + end + end end end end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index a22dc77997b..17d7e710614 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -825,7 +825,7 @@ describe Projects::IssuesController do update_issue(issue_params: { assignee_ids: [assignee.id] }) expect(json_response['assignees'].first.keys) - .to match_array(%w(id name username avatar_url state web_url)) + .to include(*%w(id name username avatar_url state web_url)) end end @@ -1408,6 +1408,7 @@ describe Projects::IssuesController do it 'render merge request as json' do create_merge_request + expect(response).to have_gitlab_http_status(:ok) expect(response).to match_response_schema('merge_request') end |