summaryrefslogtreecommitdiffstats
path: root/spec/unit/util/settings
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/util/settings
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/util/settings')
-rwxr-xr-xspec/unit/util/settings/file_setting.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/unit/util/settings/file_setting.rb b/spec/unit/util/settings/file_setting.rb
index dfe4d25d0..a6b7f024b 100755
--- a/spec/unit/util/settings/file_setting.rb
+++ b/spec/unit/util/settings/file_setting.rb
@@ -8,6 +8,10 @@ require 'puppet/util/settings/file_setting'
describe Puppet::Util::Settings::FileSetting do
FileSetting = Puppet::Util::Settings::FileSetting
+ before do
+ @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath"
+ end
+
describe "when determining whether the service user should be used" do
before do
@settings = mock 'settings'
@@ -120,7 +124,7 @@ describe Puppet::Util::Settings::FileSetting do
before do
@settings = mock 'settings'
@file = Puppet::Util::Settings::FileSetting.new(:settings => @settings, :desc => "eh", :name => :mydir, :section => "mysect")
- @settings.stubs(:value).with(:mydir).returns "/my/file"
+ @settings.stubs(:value).with(:mydir).returns @basepath
end
it "should skip files that cannot determine their types" do
@@ -131,20 +135,24 @@ describe Puppet::Util::Settings::FileSetting do
it "should skip non-existent files if 'create_files' is not enabled" do
@file.expects(:create_files?).returns false
@file.expects(:type).returns :file
- File.expects(:exist?).with("/my/file").returns false
+ File.expects(:exist?).with(@basepath).returns false
@file.to_resource.should be_nil
end
it "should manage existent files even if 'create_files' is not enabled" do
@file.expects(:create_files?).returns false
@file.expects(:type).returns :file
- File.expects(:exist?).with("/my/file").returns true
+ File.expects(:exist?).with(@basepath).returns true
@file.to_resource.should be_instance_of(Puppet::Resource)
end
- it "should skip files in /dev" do
- @settings.stubs(:value).with(:mydir).returns "/dev/file"
- @file.to_resource.should be_nil
+ describe "on POSIX systems" do
+ confine "no /dev on Win32" => Puppet.features.posix?
+
+ it "should skip files in /dev" do
+ @settings.stubs(:value).with(:mydir).returns "/dev/file"
+ @file.to_resource.should be_nil
+ end
end
it "should skip files whose paths are not strings" do
@@ -155,7 +163,7 @@ describe Puppet::Util::Settings::FileSetting do
it "should return a file resource with the path set appropriately" do
resource = @file.to_resource
resource.type.should == "File"
- resource.title.should == "/my/file"
+ resource.title.should == @basepath
end
it "should fully qualified returned files if necessary (#795)" do