summaryrefslogtreecommitdiff
path: root/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb
blob: 2d633828ae3c01da481e12dc251dc947575ac328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

require 'spec_helper'

RSpec.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