summaryrefslogtreecommitdiff
path: root/spec/workers/reactive_caching_worker_spec.rb
blob: dd654c941bcd3d4cc3013acd1797b70321c6d859 (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
28
29
require 'spec_helper'

describe ReactiveCachingWorker do
  let(:service) { project.deployment_platform }
  subject { described_class.new.perform("KubernetesService", service.id) }

  describe '#perform' do
    shared_examples 'correct behavior with perform' do
      it 'calls #exclusively_update_reactive_cache!' do
        expect_any_instance_of(KubernetesService).to receive(:exclusively_update_reactive_cache!)

        subject
      end
    end

    context 'when user configured kubernetes from Integration > Kubernetes' do
      let(:project) { create(:kubernetes_project) }

      it_behaves_like 'correct behavior with perform'
    end

    context 'when user configured kubernetes from CI/CD > Clusters' do
      let!(:cluster) { create(:cluster, :project, :provided_by_gcp) }
      let(:project) { cluster.project }

      it_behaves_like 'correct behavior with perform'
    end
  end
end