spec/packer_config_spec.rb in packer-config-0.0.3 vs spec/packer_config_spec.rb in packer-config-0.0.4
- old
+ new
@@ -32,12 +32,11 @@
end
describe "#validate" do
it 'returns true for a valid instance' do
expect(packer.builders).to receive(:length).and_return(1)
- open3 = class_double("Open3").as_stubbed_const(:transfer_nested_constants => true)
- expect(open3).to receive(:capture3).and_return(['output', 'error', 0])
+ expect(Packer::Runner).to receive(:run!).and_return('')
FakeFS do
expect(packer.validate).to be_truthy
end
end
@@ -84,12 +83,11 @@
describe "#build" do
it 'returns successfully if the build command returns a successful exit code' do
expect(packer).to receive(:validate).and_return(true)
expect(packer).to receive(:write).and_return(true)
- open3 = class_double("Open3").as_stubbed_const(:transfer_nested_constants => true)
- expect(open3).to receive(:capture3).and_return(['output', 'error', 0])
+ expect(Packer::Runner).to receive(:run!).and_return('')
FakeFS do
expect(packer.build).to be_truthy
end
end
@@ -107,12 +105,11 @@
end
it 'raises an error if the build command returns an unsuccessful exit code' do
expect(packer).to receive(:validate).and_return(true)
expect(packer).to receive(:write).and_return(true)
- open3 = class_double("Open3").as_stubbed_const(:transfer_nested_constants => true)
- expect(open3).to receive(:capture3).and_return(['output', 'error', 1])
+ expect(Packer::Runner).to receive(:run!).and_raise(Packer::Runner::CommandExecutionError)
FakeFS do
expect { packer.build }.to raise_error
end
end
end
@@ -191,7 +188,6 @@
describe '#macro' do
it 'creates a packer macro reference for any method call' do
expect(packer.macro.var).to eq('{{ .Var }}')
end
end
-
-end
\ No newline at end of file
+end