Sha256: 6c21039abf400c80ba0aa4cdea479d1bea0a41208c73f3b65ed0cb4381700eaa

Contents?: true

Size: 1.54 KB

Versions: 57

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'
require 'puppet/pops'
require 'puppet_spec/pops'

describe 'BinderConfig' do
  include PuppetSpec::Pops

  let(:acceptor)    { Puppet::Pops::Validation::Acceptor.new() }
  let(:diag)        { Puppet::Pops::Binder::Config::DiagnosticProducer.new(acceptor) }
  let(:issues)      { Puppet::Pops::Binder::Config::Issues }

  it 'should load default config if no config file exists' do
    diagnostics = diag
    config = Puppet::Pops::Binder::Config::BinderConfig.new(diagnostics)
    expect(acceptor.errors?()).to be == false
    expect(config.layering_config[0]['name']).to    be == 'site'
    expect(config.layering_config[0]['include']).to be == ['confdir:/default?optional']
    expect(config.layering_config[1]['name']).to    be == 'modules'
    expect(config.layering_config[1]['include']).to be == ['module:/*::default']
  end

  it 'should load binder_config.yaml if it exists in confdir)' do
    Puppet::Pops::Binder::Config::BinderConfig.any_instance.stubs(:confdir).returns(my_fixture("/ok/"))
    config = Puppet::Pops::Binder::Config::BinderConfig.new(diag)
    expect(acceptor.errors?()).to be == false
    expect(config.layering_config[0]['name']).to    be == 'site'
    expect(config.layering_config[0]['include']).to be == 'confdir:/'
    expect(config.layering_config[1]['name']).to    be == 'modules'
    expect(config.layering_config[1]['include']).to be == 'module:/*::test/'
    expect(config.layering_config[1]['exclude']).to be == 'module:/bad::test/'
  end

  # TODO: test error conditions (see BinderConfigChecker for what to test)

end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.8.1-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.5 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.5-x86-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.5-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.4 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.4-x86-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.4-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.3 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.3-x86-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.3-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.2 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.2-x86-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.2-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.1 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.1-x86-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.1-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.0 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.0-x86-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.7.0-x64-mingw32 spec/unit/pops/binder/config/binder_config_spec.rb
puppet-3.6.2 spec/unit/pops/binder/config/binder_config_spec.rb