diff options
-rwxr-xr-x | spec/unit/indirector/report/processor.rb | 4 | ||||
-rw-r--r-- | spec/unit/network/client.rb | 2 | ||||
-rwxr-xr-x | spec/unit/network/client/master.rb | 2 | ||||
-rwxr-xr-x | spec/unit/util/storage.rb | 7 |
4 files changed, 13 insertions, 2 deletions
diff --git a/spec/unit/indirector/report/processor.rb b/spec/unit/indirector/report/processor.rb index bcb400bda..3ee9b1b5e 100755 --- a/spec/unit/indirector/report/processor.rb +++ b/spec/unit/indirector/report/processor.rb @@ -8,6 +8,10 @@ require File.dirname(__FILE__) + '/../../../spec_helper' require 'puppet/indirector/report/processor' describe Puppet::Transaction::Report::Processor do + before do + Puppet.settings.stubs(:use).returns(true) + end + it "should provide a method for saving reports" do Puppet::Transaction::Report::Processor.new.should respond_to(:save) end diff --git a/spec/unit/network/client.rb b/spec/unit/network/client.rb index bc41efb4f..e9467aad0 100644 --- a/spec/unit/network/client.rb +++ b/spec/unit/network/client.rb @@ -9,8 +9,10 @@ require 'puppet/network/client' describe Puppet::Network::Client do before do + Puppet.settings.stubs(:use).returns(true) Puppet::Network::HttpPool.stubs(:cert_setup) end + describe "when keep-alive is enabled" do before do Puppet::Network::HttpPool.stubs(:keep_alive?).returns true diff --git a/spec/unit/network/client/master.rb b/spec/unit/network/client/master.rb index c0ad7562f..79ab8c86f 100755 --- a/spec/unit/network/client/master.rb +++ b/spec/unit/network/client/master.rb @@ -8,6 +8,7 @@ require 'puppet/network/client/master' describe Puppet::Network::Client::Master, " when retrieving the catalog" do before do + Puppet.settings.stubs(:use).returns(true) @master = mock 'master' @client = Puppet::Network::Client.master.new( :Master => @master @@ -218,6 +219,7 @@ end describe Puppet::Network::Client::Master, " when using the cached catalog" do before do + Puppet.settings.stubs(:use).returns(true) @master = mock 'master' @client = Puppet::Network::Client.master.new( :Master => @master diff --git a/spec/unit/util/storage.rb b/spec/unit/util/storage.rb index 90625bd71..b2c350267 100755 --- a/spec/unit/util/storage.rb +++ b/spec/unit/util/storage.rb @@ -85,7 +85,7 @@ describe Puppet::Util::Storage do end describe "when loading from the state file" do - before(:each) do + before do Puppet.settings.stubs(:use).returns(true) end @@ -143,6 +143,7 @@ describe Puppet::Util::Storage do it "should initialize with a clear internal state if the state file does not contain valid YAML" do @state_file.write(:booness) + @state_file.flush() proc { Puppet::Util::Storage.load() }.should_not raise_error() Puppet::Util::Storage.state().should == {} @@ -150,7 +151,9 @@ describe Puppet::Util::Storage do it "should raise an error if the state file does not contain valid YAML and cannot be renamed" do @state_file.write(:booness) - File.chmod(0000, @state_file.path()) + @state_file.flush() + YAML.expects(:load).raises(Puppet::Error) + File.expects(:rename).raises(SystemCallError) proc { Puppet::Util::Storage.load() }.should raise_error() end |