summaryrefslogtreecommitdiffstats
path: root/spec/integration/node/environment_spec.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-06-28 16:32:11 -0700
committerMarkus Roberts <Markus@reality.com>2010-06-28 16:32:11 -0700
commit9ceb4540a567b0a9de85af5397df4a292303a9c3 (patch)
tree30d1e1601888381baaaa14bfc5ee7246fd5c78e8 /spec/integration/node/environment_spec.rb
parent85638cf427fe9b35d3e3b0fa4ce919c5806c60d3 (diff)
downloadpuppet-9ceb4540a567b0a9de85af5397df4a292303a9c3.tar.gz
puppet-9ceb4540a567b0a9de85af5397df4a292303a9c3.tar.xz
puppet-9ceb4540a567b0a9de85af5397df4a292303a9c3.zip
[#3994-part 2] rename integration tests to *_spec.rb
Some spec files like active_record.rb had names that would confuse the load path and get loaded instead of the intended implentation when the spec was run from the same directory as the file. Author: Matt Robinson <matt@puppetlabs.com> Date: Fri Jun 11 15:29:33 2010 -0700
Diffstat (limited to 'spec/integration/node/environment_spec.rb')
-rwxr-xr-xspec/integration/node/environment_spec.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/spec/integration/node/environment_spec.rb b/spec/integration/node/environment_spec.rb
new file mode 100755
index 000000000..68dfd93a3
--- /dev/null
+++ b/spec/integration/node/environment_spec.rb
@@ -0,0 +1,58 @@
+#!/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