kitchen-terraform 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/lib/kitchen/driver/terraform.rb +57 -0
- data/lib/kitchen/provisioner/terraform.rb +58 -0
- data/lib/kitchen/verifier/terraform.rb +109 -0
- data/lib/terraform/apply_command.rb +32 -0
- data/lib/terraform/client.rb +102 -0
- data/lib/terraform/client_holder.rb +26 -0
- data/lib/terraform/command.rb +58 -0
- data/lib/terraform/command_options.rb +45 -0
- data/lib/terraform/error.rb +20 -0
- data/lib/terraform/get_command.rb +32 -0
- data/lib/terraform/inspec_runner.rb +44 -0
- data/lib/terraform/invalid_version.rb +34 -0
- data/lib/terraform/output_command.rb +38 -0
- data/lib/terraform/output_not_found.rb +23 -0
- data/lib/terraform/plan_command.rb +35 -0
- data/lib/terraform/validate_command.rb +32 -0
- data/lib/terraform/version.rb +19 -0
- data/lib/terraform/version_command.rb +32 -0
- data/spec/lib/kitchen/driver/terraform_spec.rb +126 -0
- data/spec/lib/kitchen/provisioner/terraform_spec.rb +106 -0
- data/spec/lib/kitchen/verifier/terraform_spec.rb +302 -0
- data/spec/lib/terraform/apply_command_spec.rb +32 -0
- data/spec/lib/terraform/client_spec.rb +211 -0
- data/spec/lib/terraform/command_options_spec.rb +34 -0
- data/spec/lib/terraform/get_command_spec.rb +30 -0
- data/spec/lib/terraform/inspec_runner_spec.rb +67 -0
- data/spec/lib/terraform/output_command_spec.rb +58 -0
- data/spec/lib/terraform/plan_command_spec.rb +46 -0
- data/spec/lib/terraform/validate_command_spec.rb +30 -0
- data/spec/lib/terraform/version_command_spec.rb +30 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/coverage.rb +21 -0
- data/spec/support/terraform/client_holder_context.rb +26 -0
- data/spec/support/terraform/client_holder_examples.rb +36 -0
- data/spec/support/terraform/command_examples.rb +80 -0
- data/spec/support/terraform/versions_are_set_examples.rb +35 -0
- metadata +329 -0
- metadata.gz.sig +2 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/command_options'
|
18
|
+
|
19
|
+
RSpec.describe Terraform::CommandOptions do
|
20
|
+
describe '#to_s' do
|
21
|
+
let :described_instance do
|
22
|
+
described_class.new single_argument: 'argument',
|
23
|
+
multiple_arguments: %w(argument argument)
|
24
|
+
end
|
25
|
+
|
26
|
+
subject { described_instance.to_s }
|
27
|
+
|
28
|
+
it 'transform the options in to flags' do
|
29
|
+
is_expected.to eq '-single-argument=argument ' \
|
30
|
+
'-multiple-arguments=argument ' \
|
31
|
+
'-multiple-arguments=argument'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/get_command'
|
18
|
+
require 'support/terraform/command_examples'
|
19
|
+
|
20
|
+
RSpec.describe Terraform::GetCommand do
|
21
|
+
it_behaves_like Terraform::Command do
|
22
|
+
let(:command_options) { '-update=true' }
|
23
|
+
|
24
|
+
let(:described_instance) { described_class.new dir: target }
|
25
|
+
|
26
|
+
let(:name) { 'get' }
|
27
|
+
|
28
|
+
let(:target) { '<directory>' }
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'kitchen/verifier/terraform'
|
18
|
+
require 'terraform/inspec_runner'
|
19
|
+
|
20
|
+
RSpec.describe Terraform::InspecRunner do
|
21
|
+
let(:described_instance) { described_class.new }
|
22
|
+
|
23
|
+
describe '#add(targets:)' do
|
24
|
+
let(:target) { instance_double Object }
|
25
|
+
|
26
|
+
after { described_instance.add targets: [target] }
|
27
|
+
|
28
|
+
subject { described_instance }
|
29
|
+
|
30
|
+
it 'adds each target' do
|
31
|
+
is_expected.to receive(:add_target).with target, described_instance.conf
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#define_attribute(name:, value:)' do
|
36
|
+
let(:name) { :name }
|
37
|
+
|
38
|
+
let(:value) { instance_double Object }
|
39
|
+
|
40
|
+
before { described_instance.define_attribute name: name, value: value }
|
41
|
+
|
42
|
+
subject { described_instance.conf.fetch 'attributes' }
|
43
|
+
|
44
|
+
it 'defines an attribute on the runner' do
|
45
|
+
is_expected.to include 'name' => value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#verify_run(verifier:)' do
|
50
|
+
let(:exit_code) { instance_double Object }
|
51
|
+
|
52
|
+
let(:verifier) { instance_double Kitchen::Verifier::Terraform }
|
53
|
+
|
54
|
+
before do
|
55
|
+
allow(described_instance).to receive(:run).with(no_args)
|
56
|
+
.and_return exit_code
|
57
|
+
end
|
58
|
+
|
59
|
+
after { described_instance.verify_run verifier: verifier }
|
60
|
+
|
61
|
+
subject { verifier }
|
62
|
+
|
63
|
+
it 'verifies the exit code after running' do
|
64
|
+
is_expected.to receive(:evaluate).with exit_code: exit_code
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/output_command'
|
18
|
+
require 'support/terraform/command_examples'
|
19
|
+
|
20
|
+
RSpec.describe Terraform::OutputCommand do
|
21
|
+
let(:described_instance) { described_class.new state: state, name: target }
|
22
|
+
|
23
|
+
let(:state) { '<state_pathname>' }
|
24
|
+
|
25
|
+
let(:target) { '<name>' }
|
26
|
+
|
27
|
+
it_behaves_like Terraform::Command do
|
28
|
+
let(:command_options) { "-state=#{state}" }
|
29
|
+
|
30
|
+
let(:name) { 'output' }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#handle(error:)' do
|
34
|
+
let(:error) { instance_double Exception }
|
35
|
+
|
36
|
+
before do
|
37
|
+
allow(error).to receive(:message).with(no_args).and_return message
|
38
|
+
|
39
|
+
allow(error).to receive(:backtrace).with no_args
|
40
|
+
end
|
41
|
+
|
42
|
+
subject { proc { described_instance.handle error: error } }
|
43
|
+
|
44
|
+
context 'when the error message does match the pattern' do
|
45
|
+
let(:message) { 'nothing to output' }
|
46
|
+
|
47
|
+
it 'does raise an error' do
|
48
|
+
is_expected.to raise_error Terraform::OutputNotFound
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'when the error message does not match the pattern' do
|
53
|
+
let(:message) { 'a thing to output' }
|
54
|
+
|
55
|
+
it('does not raise an error') { is_expected.to_not raise_error }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/plan_command'
|
18
|
+
require 'support/terraform/command_examples'
|
19
|
+
|
20
|
+
RSpec.describe Terraform::PlanCommand do
|
21
|
+
it_behaves_like Terraform::Command do
|
22
|
+
let :command_options do
|
23
|
+
"-destroy=#{destroy} -input=false -out=#{out} " \
|
24
|
+
"-state=#{state} -var=#{var} -var-file=#{var_file}"
|
25
|
+
end
|
26
|
+
|
27
|
+
let :described_instance do
|
28
|
+
described_class.new destroy: destroy, out: out, state: state, var: var,
|
29
|
+
var_file: var_file, dir: target
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:destroy) { true }
|
33
|
+
|
34
|
+
let(:name) { 'plan' }
|
35
|
+
|
36
|
+
let(:out) { '<plan_pathname>' }
|
37
|
+
|
38
|
+
let(:state) { '<state_pathname>' }
|
39
|
+
|
40
|
+
let(:target) { '<directory>' }
|
41
|
+
|
42
|
+
let(:var) { '"foo=bar"' }
|
43
|
+
|
44
|
+
let(:var_file) { '<variable_file>' }
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/validate_command'
|
18
|
+
require 'support/terraform/command_examples'
|
19
|
+
|
20
|
+
RSpec.describe Terraform::ValidateCommand do
|
21
|
+
it_behaves_like Terraform::Command do
|
22
|
+
let(:command_options) { '' }
|
23
|
+
|
24
|
+
let(:described_instance) { described_class.new dir: target }
|
25
|
+
|
26
|
+
let(:name) { 'validate' }
|
27
|
+
|
28
|
+
let(:target) { '<directory>' }
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/version_command'
|
18
|
+
require 'support/terraform/command_examples'
|
19
|
+
|
20
|
+
RSpec.describe Terraform::VersionCommand do
|
21
|
+
it_behaves_like Terraform::Command do
|
22
|
+
let(:command_options) { '' }
|
23
|
+
|
24
|
+
let(:described_instance) { described_class.new }
|
25
|
+
|
26
|
+
let(:name) { 'version' }
|
27
|
+
|
28
|
+
let(:target) { '' }
|
29
|
+
end
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'support/coverage'
|
18
|
+
|
19
|
+
RSpec.configure do |configuration|
|
20
|
+
configuration.disable_monkey_patching!
|
21
|
+
|
22
|
+
configuration.mock_with :rspec do |mocks|
|
23
|
+
mocks.verify_doubled_constant_names = true
|
24
|
+
|
25
|
+
mocks.verify_partial_doubles = true
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'simplecov'
|
18
|
+
|
19
|
+
SimpleCov.minimum_coverage 100
|
20
|
+
|
21
|
+
SimpleCov.start
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/client'
|
18
|
+
|
19
|
+
RSpec.shared_context '#client' do
|
20
|
+
let(:client) { instance_double Terraform::Client }
|
21
|
+
|
22
|
+
before do
|
23
|
+
allow(described_instance).to receive(:client).with(no_args)
|
24
|
+
.and_return client
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/client_holder'
|
18
|
+
|
19
|
+
RSpec.shared_examples Terraform::ClientHolder do
|
20
|
+
describe '#client' do
|
21
|
+
let(:instance) { instance_double Kitchen::Instance }
|
22
|
+
|
23
|
+
before do
|
24
|
+
allow(described_instance).to receive(:instance).with(no_args)
|
25
|
+
.and_return instance
|
26
|
+
|
27
|
+
allow(instance).to receive(:name).with no_args
|
28
|
+
|
29
|
+
allow(instance).to receive(:provisioner).with no_args
|
30
|
+
end
|
31
|
+
|
32
|
+
subject { described_instance.client }
|
33
|
+
|
34
|
+
it('is a Terraform client') { is_expected.to be_kind_of Terraform::Client }
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016 New Context Services, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'terraform/command'
|
18
|
+
|
19
|
+
RSpec.shared_examples Terraform::Command do
|
20
|
+
describe '#execute' do
|
21
|
+
let(:shell_out) { instance_double Mixlib::ShellOut }
|
22
|
+
|
23
|
+
before do
|
24
|
+
allow(described_instance)
|
25
|
+
.to receive(:shell_out).with(no_args).and_return shell_out
|
26
|
+
|
27
|
+
allow(shell_out).to receive(:run_command).with no_args
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when the execution is successful' do
|
31
|
+
let(:stdout) { instance_double Object }
|
32
|
+
|
33
|
+
before do
|
34
|
+
allow(shell_out).to receive(:error!).with no_args
|
35
|
+
|
36
|
+
allow(shell_out).to receive(:stdout).with(no_args).and_return stdout
|
37
|
+
end
|
38
|
+
|
39
|
+
subject { ->(block) { described_instance.execute(&block) } }
|
40
|
+
|
41
|
+
it('yields the output') { is_expected.to yield_with_args stdout }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'when the execution is not successful due to a standard error' do
|
45
|
+
before { allow(shell_out).to receive(:error!).with(no_args).and_raise }
|
46
|
+
|
47
|
+
subject { proc { described_instance.execute } }
|
48
|
+
|
49
|
+
it('raises an error') { is_expected.to raise_error Terraform::Error }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#name' do
|
54
|
+
let :supported_command_names do
|
55
|
+
%w(apply destroy get output plan validate version)
|
56
|
+
end
|
57
|
+
|
58
|
+
subject { described_instance.name }
|
59
|
+
|
60
|
+
it 'is a supported command' do
|
61
|
+
is_expected.to(
|
62
|
+
satisfy { |command_name| supported_command_names.include? command_name }
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#options' do
|
68
|
+
subject { described_instance.options }
|
69
|
+
|
70
|
+
it('is a hash') { is_expected.to be_kind_of Hash }
|
71
|
+
end
|
72
|
+
|
73
|
+
describe '#to_s' do
|
74
|
+
subject { described_instance.to_s }
|
75
|
+
|
76
|
+
it 'is the converted command string' do
|
77
|
+
is_expected.to eq "terraform #{name} #{command_options} #{target}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|