summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppetlabs.com>2011-08-17 17:08:38 -0700
committerJosh Cooper <josh@puppetlabs.com>2011-08-17 17:16:59 -0700
commitaf87f32a016a5ed48353f516f9558f95c54c50b4 (patch)
treee68fe71567fd1f21b5e0561636f81605163d3b7d
parentcf95530964a067374f2ff8be0602342e47a55cc5 (diff)
downloadpuppet-af87f32a016a5ed48353f516f9558f95c54c50b4.tar.gz
puppet-af87f32a016a5ed48353f516f9558f95c54c50b4.tar.xz
puppet-af87f32a016a5ed48353f516f9558f95c54c50b4.zip
maint: Fix build break due to recent merge from 2.7.x to master
The resource_spec was failing because /etc is not considered a fully-qualified path on Windows. Using File.expand_path fixes that. The suidmanager_spec was failing because we weren't stubbing the microsoft_windows feature, so SUIDManager.asuser was a no-op when running as root, and our expectations weren't being met.
-rwxr-xr-xspec/unit/application/resource_spec.rb7
-rwxr-xr-xspec/unit/util/suidmanager_spec.rb3
2 files changed, 7 insertions, 3 deletions
diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb
index 01cd17e00..b6ed8598d 100755
--- a/spec/unit/application/resource_spec.rb
+++ b/spec/unit/application/resource_spec.rb
@@ -235,12 +235,13 @@ describe Puppet::Application::Resource do
end
it "should output a file resource when given a file path" do
- res = Puppet::Type.type(:file).new(:path => "/etc").to_resource
+ path = File.expand_path('/etc')
+ res = Puppet::Type.type(:file).new(:path => path).to_resource
Puppet::Resource.indirection.expects(:find).returns(res)
- @resource.command_line.stubs(:args).returns(['file', '/etc'])
+ @resource.command_line.stubs(:args).returns(['file', path])
@resource.expects(:puts).with do |args|
- args.should =~ /file \{ '\/etc'/m
+ args.should =~ /file \{ '#{Regexp.escape(path)}'/m
end
@resource.main
diff --git a/spec/unit/util/suidmanager_spec.rb b/spec/unit/util/suidmanager_spec.rb
index fc70e1718..abfe3f723 100755
--- a/spec/unit/util/suidmanager_spec.rb
+++ b/spec/unit/util/suidmanager_spec.rb
@@ -33,6 +33,7 @@ describe Puppet::Util::SUIDManager do
describe "#asuser" do
it "should set euid/egid when root" do
Process.stubs(:uid).returns(0)
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
Process.stubs(:egid).returns(51)
Process.stubs(:euid).returns(50)
@@ -168,6 +169,8 @@ describe Puppet::Util::SUIDManager do
describe "with #system" do
it "should set euid/egid when root" do
Process.stubs(:uid).returns(0)
+ Puppet.features.stubs(:microsoft_windows?).returns(false)
+
Process.stubs(:egid).returns(51)
Process.stubs(:euid).returns(50)