diff options
author | Paul Berry <paul@puppetlabs.com> | 2010-11-30 12:06:33 -0800 |
---|---|---|
committer | Paul Berry <paul@puppetlabs.com> | 2010-11-30 14:39:38 -0800 |
commit | f77764de3ace7cc880a77466618a5affe1b61a8e (patch) | |
tree | 0722a29ce29cb1027c2c01687310026c4985517a /test | |
parent | 7de6af87109062a4c0b038f2f2d93191e6a93e4f (diff) | |
download | puppet-f77764de3ace7cc880a77466618a5affe1b61a8e.tar.gz puppet-f77764de3ace7cc880a77466618a5affe1b61a8e.tar.xz puppet-f77764de3ace7cc880a77466618a5affe1b61a8e.zip |
Maint: Modified tests of indirector.save to call the indirection directly.
This change replaces calls to <model object>.save with calls to <model
class>.indirection.save(<model object>). This makes the use of the
indirector explicit rather than implicit so that it will be easier to
search for all indirector call sites using grep. This is an
intermediate refactor on the way towards allowing indirector calls to
be explicitly routed to multiple termini.
This patch affects tests only; the next patch will make the
corresponding change to the code.
Diffstat (limited to 'test')
-rwxr-xr-x | test/network/handler/master.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 018f6904b..56d1991d5 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -32,15 +32,17 @@ class TestMaster < Test::Unit::TestCase def test_hostname_is_used_if_client_is_missing @master.expects(:decode_facts).returns("hostname" => "yay") - Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(stub('facts', :save => nil)) + facts = Puppet::Node::Facts.new("the_facts") + Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil) + Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(facts) @master.getconfig("facts") end def test_facts_are_saved - facts = mock('facts') + facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.expects(:new).returns(facts) - facts.expects(:save) + Puppet::Node::Facts.indirection.expects(:save).with(facts, nil) @master.stubs(:decode_facts) @@ -48,7 +50,8 @@ class TestMaster < Test::Unit::TestCase end def test_catalog_is_used_for_compiling - facts = stub('facts', :save => nil) + facts = Puppet::Node::Facts.new("the_facts") + Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil) Puppet::Node::Facts.stubs(:new).returns(facts) @master.stubs(:decode_facts) @@ -61,8 +64,9 @@ end class TestMasterFormats < Test::Unit::TestCase def setup - @facts = stub('facts', :save => nil) + @facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.stubs(:new).returns(@facts) + Puppet::Node::Facts.indirection.stubs(:save) @master = Puppet::Network::Handler.master.new(:Code => "") @master.stubs(:decode_facts) |