Mocha is leaving behind a copy of stubbed methods in the singleton class of the object on which the method is stubbed. So a later stub to any_instance of the class isn't seen by the original object.
This change works around the problem by adding a follow-up "test" that removes the method from the singleton class. See: https://github.com/floehopper/mocha/issues#issue/20 Paired-With: Paul Berry Signed-off-by: Nick Lewis <[email protected]> --- Local-branch: maint/next/mocha_workaround spec/unit/application/agent_spec.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index cee6a0d..be39707 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -293,6 +293,14 @@ 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) -- 1.7.3.3 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
