diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-22 18:09:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-22 18:09:27 +0300 |
commit | e829ca213b25b49faa619c0363059c6ed0a5a112 (patch) | |
tree | 0db00d8f17cf6f278cc68fb6b3739fda8d44fea6 /spec/workers | |
parent | 6046a605fdbb6d180861c978d17fe3516b2e7507 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb | 27 | ||||
-rw-r--r-- | spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb | 30 |
2 files changed, 57 insertions, 0 deletions
diff --git a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb new file mode 100644 index 00000000000..fcd073953b6 --- /dev/null +++ b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe AuthorizedProjectUpdate::PeriodicRecalculateWorker do + describe '#perform' do + it 'calls AuthorizedProjectUpdate::PeriodicRecalculateService' do + expect_next_instance_of(AuthorizedProjectUpdate::PeriodicRecalculateService) do |service| + expect(service).to receive(:execute) + end + + subject.perform + end + + context 'feature flag :periodic_project_authorization_recalculation is disabled' do + before do + stub_feature_flags(periodic_project_authorization_recalculation: false) + end + + it 'does not call AuthorizedProjectUpdate::PeriodicRecalculateService' do + expect(AuthorizedProjectUpdate::PeriodicRecalculateService).not_to receive(:new) + + subject.perform + end + end + end +end diff --git a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb new file mode 100644 index 00000000000..5d1c405dfd0 --- /dev/null +++ b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker do + let(:start_user_id) { 42 } + let(:end_user_id) { 4242 } + + describe '#perform' do + it 'calls AuthorizedProjectUpdate::RecalculateForUserRangeService' do + expect_next_instance_of(AuthorizedProjectUpdate::RecalculateForUserRangeService) do |service| + expect(service).to receive(:execute) + end + + subject.perform(start_user_id, end_user_id) + end + + context 'feature flag :periodic_project_authorization_recalculation is disabled' do + before do + stub_feature_flags(periodic_project_authorization_recalculation: false) + end + + it 'does not call AuthorizedProjectUpdate::RecalculateForUserRangeService' do + expect(AuthorizedProjectUpdate::RecalculateForUserRangeService).not_to receive(:new) + + subject.perform(start_user_id, end_user_id) + end + end + end +end |