diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 15:40:28 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 15:40:28 +0000 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/workers/remove_expired_group_links_worker_spec.rb | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) | |
download | gitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/workers/remove_expired_group_links_worker_spec.rb')
-rw-r--r-- | spec/workers/remove_expired_group_links_worker_spec.rb | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/spec/workers/remove_expired_group_links_worker_spec.rb b/spec/workers/remove_expired_group_links_worker_spec.rb index 151bbb75226..7bdf6fc0d59 100644 --- a/spec/workers/remove_expired_group_links_worker_spec.rb +++ b/spec/workers/remove_expired_group_links_worker_spec.rb @@ -51,16 +51,41 @@ RSpec.describe RemoveExpiredGroupLinksWorker do subject.perform end - it 'removes project authorization', :sidekiq_inline do - shared_group = group_group_link.shared_group - shared_with_group = group_group_link.shared_with_group - project = create(:project, group: shared_group) + context 'with skip_group_share_unlink_auth_refresh feature flag disabled' do + before do + stub_feature_flags(skip_group_share_unlink_auth_refresh: false) + end + + it 'removes project authorization', :sidekiq_inline do + shared_group = group_group_link.shared_group + shared_with_group = group_group_link.shared_with_group + project = create(:project, group: shared_group) + + user = create(:user) + shared_with_group.add_maintainer(user) + + expect { subject.perform }.to( + change { user.can?(:read_project, project) }.from(true).to(false)) + end + end + + context 'with skip_group_share_unlink_auth_refresh feature flag enabled' do + before do + stub_feature_flags(skip_group_share_unlink_auth_refresh: true) + end + + it 'does not remove project authorization', :sidekiq_inline do + shared_group = group_group_link.shared_group + shared_with_group = group_group_link.shared_with_group + project = create(:project, group: shared_group) + + user = create(:user) + shared_with_group.add_maintainer(user) - user = create(:user) - shared_with_group.add_maintainer(user) + subject.perform - expect { subject.perform }.to( - change { user.can?(:read_project, project) }.from(true).to(false)) + expect(user.can?(:read_project, project)).to be_truthy + end end end |