Sha256: 6e6bc6e84f4f7178f4ebdd74e3fd8b2e00e8951b8a26a9446f22ee74be167803

Contents?: true

Size: 1.73 KB

Versions: 8

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'
require 'puppet/settings/environment_conf.rb'

describe Puppet::Settings::EnvironmentConf do

  context "with config" do
    let(:config) { stub(:config) }
    let(:envconf) { Puppet::Settings::EnvironmentConf.new("/some/direnv", config, ["/global/modulepath"]) }

    it "reads a modulepath from config and does not include global_module_path" do
      config.expects(:setting).with(:modulepath).returns(
        mock('setting', :value => '/some/modulepath')
      )
      expect(envconf.modulepath).to eq(File.expand_path('/some/modulepath'))
    end

    it "reads a manifest from config" do
      config.expects(:setting).with(:manifest).returns(
        mock('setting', :value => '/some/manifest')
      )
      expect(envconf.manifest).to eq(File.expand_path('/some/manifest'))
    end

    it "reads a config_version from config" do
      config.expects(:setting).with(:config_version).returns(
        mock('setting', :value => '/some/version.sh')
      )
      expect(envconf.config_version).to eq(File.expand_path('/some/version.sh'))
    end

  end

  context "without config" do
    let(:envconf) { Puppet::Settings::EnvironmentConf.new("/some/direnv", nil, ["/global/modulepath"]) }

    it "returns a default modulepath when config has none, with global_module_path" do
      expect(envconf.modulepath).to eq(
        [File.expand_path('/some/direnv/modules'),
        File.expand_path('/global/modulepath')].join(File::PATH_SEPARATOR)
      )
    end

    it "returns a default manifest when config has none" do
      expect(envconf.manifest).to eq(File.expand_path('/some/direnv/manifests'))
    end

    it "returns nothing for config_version when config has none" do
      expect(envconf.config_version).to be_nil
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-3.6.2 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.2-x86-mingw32 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.1 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.1-x86-mingw32 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.0 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.0-x86-mingw32 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.0.rc1 spec/unit/settings/environment_conf_spec.rb
puppet-3.6.0.rc1-x86-mingw32 spec/unit/settings/environment_conf_spec.rb