From 37a55306aa08e2004103e9a4a2a94bba18ffa61d Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Wed, 12 May 2010 18:26:43 -0700 Subject: Feature #2935 Modes: root? predicate Use a predicate method to check if we're running as root, rather than comparing the effective user id Signed-off-by: Jesse Wolfe --- spec/unit/application/master.rb | 2 +- spec/unit/transaction/resource_harness.rb | 2 +- spec/unit/type/file/owner.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/unit/application/master.rb b/spec/unit/application/master.rb index 54336c10e..f082ece16 100644 --- a/spec/unit/application/master.rb +++ b/spec/unit/application/master.rb @@ -391,7 +391,7 @@ describe Puppet::Application::Master do end it "should drop privileges if running as root" do - Process.stubs(:uid).returns(0) + Puppet.features.stubs(:root?).returns true Puppet::Util.expects(:chuser) diff --git a/spec/unit/transaction/resource_harness.rb b/spec/unit/transaction/resource_harness.rb index 2abec3cc0..3b9a42a38 100755 --- a/spec/unit/transaction/resource_harness.rb +++ b/spec/unit/transaction/resource_harness.rb @@ -101,7 +101,7 @@ describe Puppet::Transaction::ResourceHarness do before do @current_state = Puppet::Resource.new(:file, "/my/file") @resource.stubs(:retrieve).returns @current_state - Puppet::Util::SUIDManager.stubs(:uid).returns 0 + Puppet.features.stubs(:root?).returns true end it "should retrieve the current values from the resource" do diff --git a/spec/unit/type/file/owner.rb b/spec/unit/type/file/owner.rb index 62f7b0ae5..6891ba210 100755 --- a/spec/unit/type/file/owner.rb +++ b/spec/unit/type/file/owner.rb @@ -56,7 +56,7 @@ describe property do describe "when determining if the file is in sync" do describe "and not running as root" do it "should warn once and return true" do - Puppet::Util::SUIDManager.expects(:uid).returns 1 + Puppet.features.expects(:root?).returns false @owner.expects(:warnonce) @@ -66,7 +66,7 @@ describe property do end before do - Puppet::Util::SUIDManager.stubs(:uid).returns 0 + Puppet.features.stubs(:root?).returns true end it "should be in sync if 'should' is not provided" do -- cgit