Sha256: 21f3dac59a72b112db7a3cd83f1b36a00e970ee8f8dcd9d2e0b29f820eddfcab

Contents?: true

Size: 709 Bytes

Versions: 5

Compression:

Stored size: 709 Bytes

Contents

# Encoding: utf-8
require 'spec_helper'
require 'fakefs/spec_helpers'

RSpec.describe Packer::Runner do
  describe '#run!' do
    it 'returns stdout on success' do
      open3 = class_double("Open3").as_stubbed_const(:transfer_nested_constants => true)
      expect(open3).to receive(:capture3).and_return(['output', 'error', 0])
      expect(described_class.run!('true', quiet: true)).to eq('output')
    end

    it 'raises an error on failure' do
      open3 = class_double("Open3").as_stubbed_const(:transfer_nested_constants => true)
      expect(open3).to receive(:capture3).and_return(['output', 'error', 1])
      expect { described_class.run!('false', quiet: true) }.to raise_error
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
packer-config-1.6.5 spec/packer/runner_spec.rb
packer-config-1.6.4 spec/packer/runner_spec.rb
packer-config-1.6.3 spec/packer/runner_spec.rb
packer-config-1.6.2 spec/packer/runner_spec.rb
packer-config-1.6.1 spec/packer/runner_spec.rb