BigW Consortium Gitlab

cluster_provision_worker_spec.rb 592 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
require 'spec_helper'

describe ClusterProvisionWorker do
  describe '#perform' do
    context 'when cluster exists' do
      let(:cluster) { create(:gcp_cluster) }

      it 'provision a cluster' do
        expect_any_instance_of(Ci::ProvisionClusterService).to receive(:execute)

        described_class.new.perform(cluster.id)
      end
    end

    context 'when cluster does not exist' do
      it 'does not provision a cluster' do
        expect_any_instance_of(Ci::ProvisionClusterService).not_to receive(:execute)

        described_class.new.perform(123)
      end
    end
  end
end