diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-07-18 23:05:35 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-07-19 14:06:36 -0700 |
| commit | 462a95e3d077b1915a919399b846068816c84583 (patch) | |
| tree | f2e260c6d923d49f20a3d6094796aae36ec240fe /spec/unit/node | |
| parent | 45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d (diff) | |
| download | puppet-462a95e3d077b1915a919399b846068816c84583.tar.gz puppet-462a95e3d077b1915a919399b846068816c84583.tar.xz puppet-462a95e3d077b1915a919399b846068816c84583.zip | |
Fix tests with "relative" paths on Windows
Absolute paths on Unix, e.g. /foo/bar, are not absolute on Windows,
which breaks many test cases. This commit adds a method to
PuppetSpec::Files.make_absolute that makes the path absolute in
test cases.
On Unix (Puppet.features.posix?) it is a no-op. On Windows,
(Puppet.features.microsoft_windows?) the drive from the current
working directory is prepended.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/environment_spec.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index d1badfa3a..144e82e0c 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -144,13 +144,18 @@ describe Puppet::Node::Environment do end describe "when validating modulepath or manifestdir directories" do + before :each do + @path_one = make_absolute('/one') + @path_two = make_absolute('/two') + end + it "should not return non-directories" do env = Puppet::Node::Environment.new("testing") - FileTest.expects(:directory?).with("/one").returns true - FileTest.expects(:directory?).with("/two").returns false + FileTest.expects(:directory?).with(@path_one).returns true + FileTest.expects(:directory?).with(@path_two).returns false - env.validate_dirs(%w{/one /two}).should == %w{/one} + env.validate_dirs([@path_one, @path_two]).should == [@path_one] end it "should use the current working directory to fully-qualify unqualified paths" do @@ -158,7 +163,7 @@ describe Puppet::Node::Environment do env = Puppet::Node::Environment.new("testing") two = File.join(Dir.getwd, "two") - env.validate_dirs(%w{/one two}).should == ["/one", two] + env.validate_dirs([@path_one, 'two']).should == [@path_one, two] end end |
