diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-01-07 13:49:23 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-01-07 13:49:23 -0800 |
| commit | 27abd84611564ac573c5fde8abb6b98e6bd3d9b7 (patch) | |
| tree | 91d482964b4e470e9e180811387564118bba07fd | |
| parent | 04289febd5575ab2bb6aa0b1a121905b09cf227a (diff) | |
maint: Stop stubbing 'use' on any_instance of Puppet::Util::Settings
This is because of the fix for #5799, which means there will only be a single
instance of Puppet::Util::Settings throughout the lifetime of the spec run.
Paired-With: Paul Berry
| -rwxr-xr-x | spec/unit/application/agent_spec.rb | 8 | ||||
| -rwxr-xr-x | spec/unit/application/apply_spec.rb | 2 | ||||
| -rw-r--r-- | spec/unit/application/master_spec.rb | 19 | ||||
| -rwxr-xr-x | spec/unit/configurer_spec.rb | 15 |
4 files changed, 10 insertions, 34 deletions
diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index be397073c..cee6a0d1a 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -293,14 +293,6 @@ describe Puppet::Application::Agent do @puppetd.setup end - it "mocha work-around" do - # Mocha 0.9.10 and earlier leaves behind a bogus "use" method - # See https://github.com/floehopper/mocha/issues#issue/20 - class << Puppet.settings - remove_method :use rescue nil - end - end - it "should install a remote ca location" do Puppet::SSL::Host.expects(:ca_location=).with(:remote) diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 9485ed221..8aaa5d8f9 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -177,7 +177,7 @@ describe Puppet::Application::Apply do describe "the main command" do before :each do Puppet.stubs(:[]) - Puppet::Util::Settings.any_instance.stubs(:use) + Puppet.settings.stubs(:use) Puppet.stubs(:[]).with(:prerun_command).returns "" Puppet.stubs(:[]).with(:postrun_command).returns "" Puppet.stubs(:[]).with(:trace).returns(true) diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index 1cf06ffa6..1173752d9 100644 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -119,7 +119,7 @@ describe Puppet::Application::Master do Puppet::Log.stubs(:level=) Puppet::SSL::CertificateAuthority.stubs(:instance) Puppet::SSL::CertificateAuthority.stubs(:ca?) - Puppet::Util::Settings.any_instance.stubs(:use) + Puppet.settings.stubs(:use) @master.options.stubs(:[]).with(any_parameters) end @@ -183,14 +183,6 @@ describe Puppet::Application::Master do @master.setup end - it "mocha work-around" do - # Mocha 0.9.10 and earlier leaves behind a bogus "use" method - # See https://github.com/floehopper/mocha/issues#issue/20 - class << Puppet.settings - remove_method :use rescue nil - end - end - it "should cache class in yaml" do Puppet::Node.indirection.expects(:cache_class=).with(:yaml) @@ -220,20 +212,11 @@ describe Puppet::Application::Master do end it "should tell Puppet.settings to use :ca category" do - Puppet.settings.stubs(:use) Puppet.settings.expects(:use).with(:ca) @master.setup end - it "mocha work-around" do - # Mocha 0.9.10 and earlier leaves behind a bogus "use" method - # See https://github.com/floehopper/mocha/issues#issue/20 - class << Puppet.settings - remove_method :use rescue nil - end - end - it "should instantiate the CertificateAuthority singleton" do Puppet::SSL::CertificateAuthority.expects(:instance) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 6b4998c65..f8acdd002 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -8,7 +8,7 @@ require 'puppet/configurer' describe Puppet::Configurer do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @agent = Puppet::Configurer.new end @@ -74,7 +74,7 @@ end describe Puppet::Configurer, "when executing a catalog run" do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @agent = Puppet::Configurer.new @agent.stubs(:prepare) @agent.stubs(:facts_for_uploading).returns({}) @@ -82,6 +82,7 @@ describe Puppet::Configurer, "when executing a catalog run" do @catalog.stubs(:apply) @agent.stubs(:retrieve_catalog).returns @catalog @agent.stubs(:save_last_run_summary) + Puppet::Transaction::Report.indirection.stubs(:save) end it "should prepare for the run" do @@ -226,7 +227,7 @@ end describe Puppet::Configurer, "when sending a report" do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @configurer = Puppet::Configurer.new @configurer.stubs(:save_last_run_summary) @@ -295,7 +296,7 @@ end describe Puppet::Configurer, "when saving the summary report file" do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @configurer = Puppet::Configurer.new @report = stub 'report' @@ -325,7 +326,7 @@ end describe Puppet::Configurer, "when retrieving a catalog" do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @agent = Puppet::Configurer.new @agent.stubs(:facts_for_uploading).returns({}) @@ -455,7 +456,7 @@ end describe Puppet::Configurer, "when converting the catalog" do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @agent = Puppet::Configurer.new @catalog = Puppet::Resource::Catalog.new @@ -489,7 +490,7 @@ end describe Puppet::Configurer, "when preparing for a run" do before do - Puppet::Util::Settings.any_instance.stubs(:use).returns(true) + Puppet.settings.stubs(:use).returns(true) @agent = Puppet::Configurer.new @agent.stubs(:dostorage) @agent.stubs(:download_fact_plugins) |
