Sha256: 2931d5d64b0ac6e03a74b058d493ebf396d98ec57c55b7178bb197efac87b3fd

Contents?: true

Size: 1.74 KB

Versions: 21

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'

describe Boxes::Builder do
  let(:env) { Boxes::Environment.new }

  describe '#initialize' do
    it 'unpacks the arguments for the build' do
      build = Boxes::Builder.new(env, name: 'build-name',
                                      provider: 'vmware',
                                      template: 'ubuntu/trusty64',
                                      scripts: ['ruby.sh'])

      expect(build.template.name).to eq 'ubuntu/trusty64'
      expect(build.scripts).to include('ruby.sh')
    end

    it 'requires a name' do
      expect do
        Boxes::Builder.new(env, provider: 'vmware', template: 'ubuntu/trusty64')
      end.to raise_error(Boxes::Errors::MissingArgumentError)
    end

    it 'requires a provider' do
      expect do
        Boxes::Builder.new(env, name: 'build-name', template: 'ubuntu/trusty64')
      end.to raise_error(Boxes::Errors::MissingArgumentError)
    end

    it 'requires a template' do
      expect do
        Boxes::Builder.new(env, name: 'build-name', provider: 'vmware')
      end.to raise_error(Boxes::Errors::MissingArgumentError)
    end

    it 'throws an exception on unknown templates' do
      expect do
        Boxes::Builder.new(env, name: 'build-name',
                                provider: 'vmware',
                                template: 'nope/nope')
      end.to raise_error(Boxes::Errors::TemplateNotFoundError)
    end

    it 'throws an exception on unknown scripts' do
      expect do
        Boxes::Builder.new(env, name: 'build-name',
                                provider: 'vmware',
                                template: 'ubuntu/trusty64',
                                scripts: ['nope.sh'])
      end.to raise_error(Boxes::Errors::ScriptNotFoundError)
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
boxes-3.7.0 spec/boxes/builder_spec.rb
boxes-3.6.1 spec/boxes/builder_spec.rb
boxes-3.6.0 spec/boxes/builder_spec.rb
boxes-3.5.0 spec/boxes/builder_spec.rb
boxes-3.4.0 spec/boxes/builder_spec.rb
boxes-3.3.1 spec/boxes/builder_spec.rb
boxes-3.3.0 spec/boxes/builder_spec.rb
boxes-3.2.0 spec/boxes/builder_spec.rb
boxes-3.1.0 spec/boxes/builder_spec.rb
boxes-3.0.0 spec/boxes/builder_spec.rb
boxes-2.5.0 spec/boxes/builder_spec.rb
boxes-2.4.0 spec/boxes/builder_spec.rb
bitswarmbox-1.0.0.pre18 spec/boxes/builder_spec.rb
bitswarmbox-1.0.0.pre16 spec/boxes/builder_spec.rb
boxes-2.3.0 spec/boxes/builder_spec.rb
boxes-2.2.0 spec/boxes/builder_spec.rb
boxes-2.1.1 spec/boxes/builder_spec.rb
boxes-2.1.0 spec/boxes/builder_spec.rb
boxes-2.0.2 spec/boxes/builder_spec.rb
boxes-2.0.1 spec/boxes/builder_spec.rb