debian-mirror-gitlab/spec/workers/terraform/states/destroy_worker_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
775 B
Ruby
Raw Normal View History

2022-07-23 23:45:48 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Terraform::States::DestroyWorker do
let(:state) { create(:terraform_state) }
describe '#perform' do
let(:state_id) { state.id }
let(:deletion_service) { instance_double(Terraform::States::DestroyService, execute: true) }
subject { described_class.new.perform(state_id) }
it 'calls the deletion service' do
expect(deletion_service).to receive(:execute).once
expect(Terraform::States::DestroyService).to receive(:new)
.with(state).and_return(deletion_service)
subject
end
context 'state no longer exists' do
let(:state_id) { -1 }
it 'completes without error' do
expect { subject }.not_to raise_error
end
end
end
end