blob: 02e793732791ae23bcaf423e5b58daed2958cc5a (
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
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
|