summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorDavid Schmitt <david@dasz.at>2010-05-17 16:11:20 +0200
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitf054d5b6abe2de3810203b13c8f263d9a23f0d50 (patch)
tree19a76a255946261c40a2d9b64b9096d73dd83d9c /spec/unit/parser
parent54c453853ddb1648af14b42dca6f827c5cb8e007 (diff)
downloadpuppet-f054d5b6abe2de3810203b13c8f263d9a23f0d50.tar.gz
puppet-f054d5b6abe2de3810203b13c8f263d9a23f0d50.tar.xz
puppet-f054d5b6abe2de3810203b13c8f263d9a23f0d50.zip
Make specs work on win32
lib/: * Fix Puppet::Parser::Files * Fix Puppet::Util::Settings spec/: * unit/application/kick.rb: only run on posix * unit/application.rb * unit/parser/compiler.rb * unit/parser/files.rb * unit/resource.rb * unit/resource/catalog.rb * unit/resource/type_collection.rb * unit/transaction.rb * unit/type/tidy.rb * unit/util/settings.rb * unit/util/settings/file_setting.rb * unit/application.rb
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/compiler.rb5
-rw-r--r--spec/unit/parser/files.rb19
2 files changed, 15 insertions, 9 deletions
diff --git a/spec/unit/parser/compiler.rb b/spec/unit/parser/compiler.rb
index fb210bc02..fa65479b3 100755
--- a/spec/unit/parser/compiler.rb
+++ b/spec/unit/parser/compiler.rb
@@ -388,8 +388,9 @@ describe Puppet::Parser::Compiler do
end
it "should fail to add resources that conflict with existing resources" do
- file1 = Puppet::Type.type(:file).new :path => "/foo"
- file2 = Puppet::Type.type(:file).new :path => "/foo"
+ path = Puppet.features.posix? ? "/foo" : "C:/foo"
+ file1 = Puppet::Type.type(:file).new :path => path
+ file2 = Puppet::Type.type(:file).new :path => path
@compiler.add_resource(@scope, file1)
lambda { @compiler.add_resource(@scope, file2) }.should raise_error(Puppet::Resource::Catalog::DuplicateResourceError)
diff --git a/spec/unit/parser/files.rb b/spec/unit/parser/files.rb
index 42953b771..4c6e5b736 100644
--- a/spec/unit/parser/files.rb
+++ b/spec/unit/parser/files.rb
@@ -5,6 +5,11 @@ require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/parser/files'
describe Puppet::Parser::Files do
+
+ before do
+ @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath"
+ end
+
it "should have a method for finding a template" do
Puppet::Parser::Files.should respond_to(:find_template)
end
@@ -16,7 +21,7 @@ describe Puppet::Parser::Files do
describe "when searching for templates" do
it "should return fully-qualified templates directly" do
Puppet::Parser::Files.expects(:modulepath).never
- Puppet::Parser::Files.find_template("/my/template").should == "/my/template"
+ Puppet::Parser::Files.find_template(@basepath + "/my/template").should == @basepath + "/my/template"
end
it "should return the template from the first found module" do
@@ -136,19 +141,19 @@ describe Puppet::Parser::Files do
it "should not look for modules when paths are fully qualified" do
Puppet.expects(:value).with(:modulepath).never
- file = "/fully/qualified/file.pp"
+ file = @basepath + "/fully/qualified/file.pp"
Dir.stubs(:glob).with(file).returns([file])
Puppet::Parser::Files.find_manifests(file)
end
it "should directly return fully qualified files" do
- file = "/fully/qualified/file.pp"
+ file = @basepath + "/fully/qualified/file.pp"
Dir.stubs(:glob).with(file).returns([file])
Puppet::Parser::Files.find_manifests(file).should == [file]
end
it "should match against provided fully qualified patterns" do
- pattern = "/fully/qualified/pattern/*"
+ pattern = @basepath + "/fully/qualified/pattern/*"
Dir.expects(:glob).with(pattern).returns(%w{my file list})
Puppet::Parser::Files.find_manifests(pattern).should == %w{my file list}
end
@@ -160,9 +165,9 @@ describe Puppet::Parser::Files do
end
it "should only return files, not directories" do
- pattern = "/fully/qualified/pattern/*"
- file = "/my/file"
- dir = "/my/directory"
+ pattern = @basepath + "/fully/qualified/pattern/*"
+ file = @basepath + "/my/file"
+ dir = @basepath + "/my/directory"
Dir.expects(:glob).with(pattern).returns([file, dir])
FileTest.expects(:directory?).with(file).returns(false)
FileTest.expects(:directory?).with(dir).returns(true)