diff options
Diffstat (limited to 'spec/services/groups')
-rw-r--r-- | spec/services/groups/create_service_spec.rb | 29 | ||||
-rw-r--r-- | spec/services/groups/destroy_service_spec.rb | 40 | ||||
-rw-r--r-- | spec/services/groups/transfer_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/groups/update_service_spec.rb | 9 | ||||
-rw-r--r-- | spec/services/groups/update_shared_runners_service_spec.rb | 2 |
5 files changed, 22 insertions, 62 deletions
diff --git a/spec/services/groups/create_service_spec.rb b/spec/services/groups/create_service_spec.rb index 0a8164c9ca3..0425ba3e631 100644 --- a/spec/services/groups/create_service_spec.rb +++ b/spec/services/groups/create_service_spec.rb @@ -271,33 +271,4 @@ RSpec.describe Groups::CreateService, '#execute' do end end end - - describe 'logged_out_marketing_header experiment', :experiment do - let(:service) { described_class.new(user, group_params) } - - subject { service.execute } - - before do - stub_experiments(logged_out_marketing_header: :candidate) - end - - it 'tracks signed_up event' do - expect(experiment(:logged_out_marketing_header)).to track( - :namespace_created, - namespace: an_instance_of(Group) - ).on_next_instance.with_context(actor: user) - - subject - end - - context 'when group has not been persisted' do - let(:service) { described_class.new(user, group_params.merge(name: '<script>alert("Attack!")</script>')) } - - it 'does not track signed_up event' do - expect(experiment(:logged_out_marketing_header)).not_to track(:namespace_created) - - subject - end - end - end end diff --git a/spec/services/groups/destroy_service_spec.rb b/spec/services/groups/destroy_service_spec.rb index 36e868fa5f1..f2dbb69f855 100644 --- a/spec/services/groups/destroy_service_spec.rb +++ b/spec/services/groups/destroy_service_spec.rb @@ -36,37 +36,17 @@ RSpec.describe Groups::DestroyService do end context 'bot tokens', :sidekiq_inline do - context 'when user_destroy_with_limited_execution_time_worker is enabled' do - it 'initiates group bot removal', :aggregate_failures do - bot = create(:user, :project_bot) - group.add_developer(bot) - create(:personal_access_token, user: bot) - - destroy_group(group, user, async) - - expect( - Users::GhostUserMigration.where(user: bot, - initiator_user: user) - ).to be_exists - end - end - - context 'when user_destroy_with_limited_execution_time_worker is disabled' do - before do - stub_feature_flags(user_destroy_with_limited_execution_time_worker: false) - end - - it 'removes group bot', :aggregate_failures do - bot = create(:user, :project_bot) - group.add_developer(bot) - token = create(:personal_access_token, user: bot) + it 'initiates group bot removal', :aggregate_failures do + bot = create(:user, :project_bot) + group.add_developer(bot) + create(:personal_access_token, user: bot) - destroy_group(group, user, async) + destroy_group(group, user, async) - expect(PersonalAccessToken.find_by(id: token.id)).to be_nil - expect(User.find_by(id: bot.id)).to be_nil - expect(User.find_by(id: user.id)).not_to be_nil - end + expect( + Users::GhostUserMigration.where(user: bot, + initiator_user: user) + ).to be_exists end end @@ -146,7 +126,7 @@ RSpec.describe Groups::DestroyService do end expect { destroy_group(group, user, false) } - .to raise_error(Groups::DestroyService::DestroyError, "Project #{project.id} can't be deleted" ) + .to raise_error(Groups::DestroyService::DestroyError, "Project #{project.id} can't be deleted") end end diff --git a/spec/services/groups/transfer_service_spec.rb b/spec/services/groups/transfer_service_spec.rb index b543661e9a0..3cf2c875341 100644 --- a/spec/services/groups/transfer_service_spec.rb +++ b/spec/services/groups/transfer_service_spec.rb @@ -200,7 +200,7 @@ RSpec.describe Groups::TransferService, :sidekiq_inline do let_it_be(:project2) { create(:project, :private, namespace: group) } it_behaves_like 'project namespace path is in sync with project path' do - let(:group_full_path) { "#{group.path}" } + let(:group_full_path) { group.path.to_s } let(:projects_with_project_namespace) { [project1, project2] } end end @@ -274,7 +274,7 @@ RSpec.describe Groups::TransferService, :sidekiq_inline do end it_behaves_like 'project namespace path is in sync with project path' do - let(:group_full_path) { "#{new_parent_group.full_path}" } + let(:group_full_path) { new_parent_group.full_path.to_s } let(:projects_with_project_namespace) { [project] } end end diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb index 5c87b9ac8bb..c758d3d5477 100644 --- a/spec/services/groups/update_service_spec.rb +++ b/spec/services/groups/update_service_spec.rb @@ -101,6 +101,15 @@ RSpec.describe Groups::UpdateService do expect(public_group.reload.name).to eq('new-name') end end + + context 'when the path does not change' do + let(:params) { { name: 'new-name', path: public_group.path } } + + it 'allows the update' do + expect(subject).to be true + expect(public_group.reload.name).to eq('new-name') + end + end end context 'within subgroup' do diff --git a/spec/services/groups/update_shared_runners_service_spec.rb b/spec/services/groups/update_shared_runners_service_spec.rb index 6e938984052..98eccedeace 100644 --- a/spec/services/groups/update_shared_runners_service_spec.rb +++ b/spec/services/groups/update_shared_runners_service_spec.rb @@ -127,7 +127,7 @@ RSpec.describe Groups::UpdateSharedRunnersService do end context 'when parent does not allow' do - let_it_be(:parent) { create(:group, :shared_runners_disabled, allow_descendants_override_disabled_shared_runners: false ) } + let_it_be(:parent) { create(:group, :shared_runners_disabled, allow_descendants_override_disabled_shared_runners: false) } let_it_be(:group) { create(:group, :shared_runners_disabled, allow_descendants_override_disabled_shared_runners: false, parent: parent) } it 'results error' do |