diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /spec/services/users/refresh_authorized_projects_service_spec.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'spec/services/users/refresh_authorized_projects_service_spec.rb')
-rw-r--r-- | spec/services/users/refresh_authorized_projects_service_spec.rb | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/spec/services/users/refresh_authorized_projects_service_spec.rb b/spec/services/users/refresh_authorized_projects_service_spec.rb index 55b27954a74..b36152f81c3 100644 --- a/spec/services/users/refresh_authorized_projects_service_spec.rb +++ b/spec/services/users/refresh_authorized_projects_service_spec.rb @@ -29,8 +29,7 @@ RSpec.describe Users::RefreshAuthorizedProjectsService, feature_category: :user_ context 'incorrect_auth_found_callback callback' do let(:user) { create(:user) } let(:service) do - described_class.new(user, - incorrect_auth_found_callback: callback) + described_class.new(user, incorrect_auth_found_callback: callback) end it 'is called' do @@ -45,8 +44,7 @@ RSpec.describe Users::RefreshAuthorizedProjectsService, feature_category: :user_ context 'missing_auth_found_callback callback' do let(:service) do - described_class.new(user, - missing_auth_found_callback: callback) + described_class.new(user, missing_auth_found_callback: callback) end it 'is called' do @@ -108,10 +106,7 @@ RSpec.describe Users::RefreshAuthorizedProjectsService, feature_category: :user_ describe '#update_authorizations' do context 'when there are no rows to add and remove' do it 'does not change authorizations' do - expect(ProjectAuthorization).not_to receive(:delete_all_in_batches_for_user) - expect(ProjectAuthorization).not_to receive(:insert_all_in_batches) - - service.update_authorizations([], []) + expect { service.update_authorizations([], []) }.to not_change { user.project_authorizations.count } end end @@ -146,14 +141,15 @@ RSpec.describe Users::RefreshAuthorizedProjectsService, feature_category: :user_ user.project_authorizations.delete_all expect(Gitlab::AppJsonLogger).to( - receive(:info) - .with(event: 'authorized_projects_refresh', - user_id: user.id, - 'authorized_projects_refresh.source': source, - 'authorized_projects_refresh.rows_deleted_count': 0, - 'authorized_projects_refresh.rows_added_count': 1, - 'authorized_projects_refresh.rows_deleted_slice': [], - 'authorized_projects_refresh.rows_added_slice': [[user.id, project.id, Gitlab::Access::MAINTAINER]]) + receive(:info).with( + event: 'authorized_projects_refresh', + user_id: user.id, + 'authorized_projects_refresh.source': source, + 'authorized_projects_refresh.rows_deleted_count': 0, + 'authorized_projects_refresh.rows_added_count': 1, + 'authorized_projects_refresh.rows_deleted_slice': [], + 'authorized_projects_refresh.rows_added_slice': [[user.id, project.id, Gitlab::Access::MAINTAINER]] + ) ) to_be_added = [ |