diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/controllers/admin/groups_controller_spec.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/controllers/admin/groups_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin/groups_controller_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/controllers/admin/groups_controller_spec.rb b/spec/controllers/admin/groups_controller_spec.rb index 6085f0e1239..c534cf14327 100644 --- a/spec/controllers/admin/groups_controller_spec.rb +++ b/spec/controllers/admin/groups_controller_spec.rb @@ -52,4 +52,48 @@ RSpec.describe Admin::GroupsController do post :create, params: { group: { path: 'test', name: 'test' } } end end + + describe 'PUT #update' do + subject(:update!) do + put :update, params: { id: group.to_param, group: { runner_registration_enabled: new_value } } + end + + context 'with runner registration disabled' do + let(:runner_registration_enabled) { false } + let(:new_value) { '1' } + + it 'updates the setting successfully' do + update! + + expect(response).to have_gitlab_http_status(:found) + expect(group.reload.runner_registration_enabled).to eq(true) + end + + it 'does not change the registration token' do + expect do + update! + group.reload + end.not_to change(group, :runners_token) + end + end + + context 'with runner registration enabled' do + let(:runner_registration_enabled) { true } + let(:new_value) { '0' } + + it 'updates the setting successfully' do + update! + + expect(response).to have_gitlab_http_status(:found) + expect(group.reload.runner_registration_enabled).to eq(false) + end + + it 'changes the registration token' do + expect do + update! + group.reload + end.to change(group, :runners_token) + end + end + end end |