Sha256: bdb81cda9c528da27032f97169c2c30bc4657f4529f7f7706de2cabe051e490d

Contents?: true

Size: 945 Bytes

Versions: 10

Compression:

Stored size: 945 Bytes

Contents

require 'spec_helper'
require 'fileutils'

describe Dock0 do
  describe '#new' do
    it 'creates Image objects' do
      expect(Dock0.new).to be_an_instance_of Dock0::Image
    end
  end

  describe Dock0::Image do
    let(:image) { Dock0::Image.new 'spec/examples/image.yml' }

    it 'loads stacked config files' do
      config_image = Dock0::Image.new(
        'spec/examples/alpha.yml', 'spec/examples/beta.yml'
      )
      result = { 'foo' => 'override', 'test' => 5, 'other' => 6 }
      expect(config_image.config).to eql Dock0::DEFAULT_CONFIG.merge(result)
    end
    it 'has a timestamp' do
      expect(Dock0::Image.new.stamp).to match(/\d{4}-\d{2}-\d{2}-\d{4}/)
    end

    describe '#run' do
      it 'runs a command' do
        expect(image.run('echo "hello"')).to eql "hello\n"
      end
      it 'raises if the command fails' do
        expect { image.run('dasdks') }.to raise_error RuntimeError
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dock0-0.0.18 spec/dock0_spec.rb
dock0-0.0.17 spec/dock0_spec.rb
dock0-0.0.16 spec/dock0_spec.rb
dock0-0.0.15 spec/dock0_spec.rb
dock0-0.0.14 spec/dock0_spec.rb
dock0-0.0.13 spec/dock0_spec.rb
dock0-0.0.12 spec/dock0_spec.rb
dock0-0.0.11 spec/dock0_spec.rb
dock0-0.0.10 spec/dock0_spec.rb
dock0-0.0.9 spec/dock0_spec.rb