diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/controllers/admin/runners_controller_spec.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/controllers/admin/runners_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin/runners_controller_spec.rb | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb index b9a59e9ae5f..08fb12c375e 100644 --- a/spec/controllers/admin/runners_controller_spec.rb +++ b/spec/controllers/admin/runners_controller_spec.rb @@ -26,6 +26,32 @@ RSpec.describe Admin::RunnersController do render_views let_it_be(:project) { create(:project) } + + before_all do + create(:ci_build, runner: runner, project: project) + end + + it 'shows a runner show page' do + get :show, params: { id: runner.id } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template(:show) + end + + it 'when runner_read_only_admin_view is off, redirects to the runner edit page' do + stub_feature_flags(runner_read_only_admin_view: false) + + get :show, params: { id: runner.id } + + expect(response).to have_gitlab_http_status(:redirect) + expect(response).to redirect_to edit_admin_runner_path(runner) + end + end + + describe '#edit' do + render_views + + let_it_be(:project) { create(:project) } let_it_be(:project_two) { create(:project) } before_all do @@ -33,29 +59,29 @@ RSpec.describe Admin::RunnersController do create(:ci_build, runner: runner, project: project_two) end - it 'shows a particular runner' do - get :show, params: { id: runner.id } + it 'shows a runner edit page' do + get :edit, params: { id: runner.id } expect(response).to have_gitlab_http_status(:ok) end it 'shows 404 for unknown runner' do - get :show, params: { id: 0 } + get :edit, params: { id: 0 } expect(response).to have_gitlab_http_status(:not_found) end it 'avoids N+1 queries', :request_store do - get :show, params: { id: runner.id } + get :edit, params: { id: runner.id } - control_count = ActiveRecord::QueryRecorder.new { get :show, params: { id: runner.id } }.count + control_count = ActiveRecord::QueryRecorder.new { get :edit, params: { id: runner.id } }.count new_project = create(:project) create(:ci_build, runner: runner, project: new_project) # There is one additional query looking up subject.group in ProjectPolicy for the # needs_new_sso_session permission - expect { get :show, params: { id: runner.id } }.not_to exceed_query_limit(control_count + 1) + expect { get :edit, params: { id: runner.id } }.not_to exceed_query_limit(control_count + 1) expect(response).to have_gitlab_http_status(:ok) end |