Sha256: b13617cfff3e7c4f2603806af4cdba0a79d5a743e8d4bf2c76efa632e2fed8cc

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'

require 'puppet_spec/files'

describe Puppet::Node::Environment do
  include PuppetSpec::Files

  it "should be able to return each module from its environment with the environment, name, and path set correctly" do
    base = tmpfile("env_modules")
    Dir.mkdir(base)

    dirs = []
    mods = {}
    %w{1 2}.each do |num|
      dir = File.join(base, "dir#{num}")
      dirs << dir
      Dir.mkdir(dir)
      mod = "mod#{num}"
      moddir = File.join(dir, mod)
      mods[mod] = moddir
      Dir.mkdir(moddir)
    end

    environment = Puppet::Node::Environment.new("foo")
    environment.stubs(:modulepath).returns dirs

    environment.modules.each do |mod|
      mod.environment.should == environment
      mod.path.should == mods[mod.name]
    end
  end

  it "should not yield the same module from different module paths" do
    base = tmpfile("env_modules")
    Dir.mkdir(base)

    dirs = []
    mods = {}
    %w{1 2}.each do |num|
      dir = File.join(base, "dir#{num}")
      dirs << dir
      Dir.mkdir(dir)
      mod = "mod"
      moddir = File.join(dir, mod)
      mods[mod] = moddir
      Dir.mkdir(moddir)
    end

    environment = Puppet::Node::Environment.new("foo")
    environment.stubs(:modulepath).returns dirs

    mods = environment.modules
    mods.length.should == 1
    mods[0].path.should == File.join(base, "dir1", "mod")
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
puppet-2.6.18 spec/integration/node/environment_spec.rb
puppet-2.6.17 spec/integration/node/environment_spec.rb
puppet-2.6.16 spec/integration/node/environment_spec.rb
puppet-2.6.15 spec/integration/node/environment_spec.rb
puppet-2.6.14 spec/integration/node/environment_spec.rb
puppet-2.6.13 spec/integration/node/environment_spec.rb
puppet-2.6.12 spec/integration/node/environment_spec.rb
puppet-2.6.11 spec/integration/node/environment_spec.rb
puppet-2.6.10 spec/integration/node/environment_spec.rb
puppet-2.6.9 spec/integration/node/environment_spec.rb
puppet-2.6.8 spec/integration/node/environment_spec.rb
puppet-2.6.7 spec/integration/node/environment_spec.rb
puppet-2.6.6 spec/integration/node/environment_spec.rb
puppet-2.6.5 spec/integration/node/environment_spec.rb
puppet-2.6.4 spec/integration/node/environment_spec.rb
puppet-2.6.3 spec/integration/node/environment_spec.rb
puppet-2.6.2 spec/integration/node/environment_spec.rb
puppet-2.6.1 spec/integration/node/environment_spec.rb
puppet-2.6.0 spec/integration/node/environment_spec.rb