diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/controllers/admin | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/controllers/admin')
7 files changed, 37 insertions, 8 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 2b562e2dd64..6258dd30438 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Admin::ApplicationSettingsController do +RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_setting do include StubENV include UsageDataHelpers @@ -164,6 +164,13 @@ RSpec.describe Admin::ApplicationSettingsController do expect(ApplicationSetting.current.default_branch_name).to eq("example_branch_name") end + it "updates admin_mode setting" do + put :update, params: { application_setting: { admin_mode: true } } + + expect(response).to redirect_to(general_admin_application_settings_path) + expect(ApplicationSetting.current.admin_mode).to be(true) + end + context "personal access token prefix settings" do let(:application_settings) { ApplicationSetting.current } diff --git a/spec/controllers/admin/clusters_controller_spec.rb b/spec/controllers/admin/clusters_controller_spec.rb index 85aa77d8473..bd0c2965906 100644 --- a/spec/controllers/admin/clusters_controller_spec.rb +++ b/spec/controllers/admin/clusters_controller_spec.rb @@ -546,20 +546,30 @@ RSpec.describe Admin::ClustersController do describe 'GET #show' do let(:cluster) { create(:cluster, :provided_by_gcp, :instance) } - def get_show + def get_show(tab: nil) get :show, params: { - id: cluster + id: cluster, + tab: tab } end describe 'functionality' do + render_views + it 'responds successfully' do get_show expect(response).to have_gitlab_http_status(:ok) expect(assigns(:cluster)).to eq(cluster) end + + it 'renders integration tab view' do + get_show(tab: 'integrations') + + expect(response).to render_template('clusters/clusters/_integrations') + expect(response).to have_gitlab_http_status(:ok) + end end describe 'security' do diff --git a/spec/controllers/admin/dev_ops_report_controller_spec.rb b/spec/controllers/admin/dev_ops_report_controller_spec.rb index 913921b9630..142db175a15 100644 --- a/spec/controllers/admin/dev_ops_report_controller_spec.rb +++ b/spec/controllers/admin/dev_ops_report_controller_spec.rb @@ -5,7 +5,13 @@ require 'spec_helper' RSpec.describe Admin::DevOpsReportController do describe 'show_adoption?' do it 'is always false' do - expect(controller.show_adoption?).to be false + expect(controller.show_adoption?).to be_falsey + end + end + + describe 'should_track_devops_score?' do + it 'is always true' do + expect(controller.should_track_devops_score?).to be_truthy end end diff --git a/spec/controllers/admin/groups_controller_spec.rb b/spec/controllers/admin/groups_controller_spec.rb index 38f4ce54e5c..8441a52b454 100644 --- a/spec/controllers/admin/groups_controller_spec.rb +++ b/spec/controllers/admin/groups_controller_spec.rb @@ -37,6 +37,12 @@ RSpec.describe Admin::GroupsController do post :create, params: { group: { path: 'test', name: 'test' } } end.to change { NamespaceSetting.count }.by(1) end + + it 'creates admin_note for group' do + expect do + post :create, params: { group: { path: 'test', name: 'test', admin_note_attributes: { note: 'test' } } } + end.to change { Namespace::AdminNote.count }.by(1) + end end describe 'PUT #members_update' do diff --git a/spec/controllers/admin/impersonations_controller_spec.rb b/spec/controllers/admin/impersonations_controller_spec.rb index 326003acaf8..744c0712d6b 100644 --- a/spec/controllers/admin/impersonations_controller_spec.rb +++ b/spec/controllers/admin/impersonations_controller_spec.rb @@ -42,7 +42,7 @@ RSpec.describe Admin::ImpersonationsController do context "when the impersonator is not admin (anymore)" do before do impersonator.admin = false - impersonator.save + impersonator.save! end it "responds with status 404" do diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb index cba25dbff95..45ea8949bf2 100644 --- a/spec/controllers/admin/runners_controller_spec.rb +++ b/spec/controllers/admin/runners_controller_spec.rb @@ -125,7 +125,7 @@ RSpec.describe Admin::RunnersController do describe '#resume' do it 'marks the runner as active and ticks the queue' do - runner.update(active: false) + runner.update!(active: false) expect do post :resume, params: { id: runner.id } @@ -140,7 +140,7 @@ RSpec.describe Admin::RunnersController do describe '#pause' do it 'marks the runner as inactive and ticks the queue' do - runner.update(active: true) + runner.update!(active: true) expect do post :pause, params: { id: runner.id } diff --git a/spec/controllers/admin/services_controller_spec.rb b/spec/controllers/admin/services_controller_spec.rb index 8e78cc75369..d5ec9907b48 100644 --- a/spec/controllers/admin/services_controller_spec.rb +++ b/spec/controllers/admin/services_controller_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Admin::ServicesController do describe "#update" do let(:project) { create(:project) } let!(:service_template) do - RedmineService.create( + RedmineService.create!( project: nil, active: false, template: true, |