Sha256: c997e610a68c892c33bb7721b231646cfb3155c55e59467e3e03ea6597470880

Contents?: true

Size: 1 KB

Versions: 41

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

require 'pe_build/config'

describe PEBuild::Config::PEBootstrap do
  let(:machine)  { double('machine') }

  context 'when finalized with default values' do
    before(:each) { subject.finalize! }

    it 'passes validation' do
      errors = subject.validate(machine)

      expect(errors).to include('PE Bootstrap' => [])
    end
  end

  describe 'answer_extras' do
    it 'defaults to an empty Array' do
      subject.finalize!

      expect(subject.answer_extras).to be_a(Array)
    end

    context 'when validated with a non-array value' do
      it 'records an error' do
        subject.answer_extras = {'' => ''}

        subject.finalize!
        errors = subject.validate(machine)

        expect(errors['PE Bootstrap'].to_s).to match(/Answer_extras.*got a Hash/)
      end
    end
  end

  # TODO: Spec test the validation functions. Not critical right now since it
  # is pretty much testing tests. But, having specs is a good way for people to
  # see precisely _what_ is allowed.

end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
vagrant-pe_build-0.17.0 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.16.0 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.15.6 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.15.5 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.15.4 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.15.3 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.15.1 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.15.0 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.14.2 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.14.1 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.14.0 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.7 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.6 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.5 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.4 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.3 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.2 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.1 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.13.0 spec/unit/config/pe_bootstrap_spec.rb
vagrant-pe_build-0.12.0 spec/unit/config/pe_bootstrap_spec.rb