diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-01 12:46:12 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-04 13:32:04 -0700 |
| commit | d328af73e688df136ee6fe10340adf7ba72b951e (patch) | |
| tree | 7f05229ea2e06ad999a0f306683e806cc7f1e423 /spec | |
| parent | 4d23d60fc331220418d4502930bd2fad7ee44b84 (diff) | |
| download | puppet-d328af73e688df136ee6fe10340adf7ba72b951e.tar.gz puppet-d328af73e688df136ee6fe10340adf7ba72b951e.tar.xz puppet-d328af73e688df136ee6fe10340adf7ba72b951e.zip | |
(#6760) set terminus in indirector string base class.
We now accept a terminus option to each invocation, and set the terminus based
on that call. This is probably incomplete, because it only sets the terminus
when given, and doesn't try to reset it to the default afterwards.
This also resets the terminus class after every invocation, to stop it leaking
state across calls. This make, sadly, have some effects if you are not just
using the strings to invoke the terminus, but it beats having the strings
broken as well...
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/application/indirection_base_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/string/indirector_spec.rb | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/spec/unit/application/indirection_base_spec.rb b/spec/unit/application/indirection_base_spec.rb index f636613c4..66b3009fb 100755 --- a/spec/unit/application/indirection_base_spec.rb +++ b/spec/unit/application/indirection_base_spec.rb @@ -26,7 +26,7 @@ describe Puppet::Application::IndirectionBase do # entire indirection stack would cause us more grief. --daniel 2011-03-31 terminus = mock("test indirection terminus") Puppet::Indirector::Indirection.expects(:instance). - with(:testindirection).returns() + with(:testindirection).twice.returns() subject.command_line. instance_variable_set('@args', %w{--terminus foo save}) diff --git a/spec/unit/string/indirector_spec.rb b/spec/unit/string/indirector_spec.rb index da5f569dc..29e8e7086 100755 --- a/spec/unit/string/indirector_spec.rb +++ b/spec/unit/string/indirector_spec.rb @@ -4,12 +4,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') require 'puppet/string/indirector' describe Puppet::String::Indirector do - before do - @instance = Puppet::String::Indirector.new(:test, '0.0.1') - - @indirection = stub 'indirection', :name => :stub_indirection - - @instance.stubs(:indirection).returns @indirection + subject do + instance = Puppet::String::Indirector.new(:test, '0.0.1') + indirection = stub('indirection', + :name => :stub_indirection, + :reset_terminus_class => nil) + instance.stubs(:indirection).returns indirection + instance end it "should be able to return a list of indirections" do @@ -34,8 +35,8 @@ describe Puppet::String::Indirector do end it "should call the indirection method when the '#{method}' action is invoked" do - @instance.indirection.expects(method).with(:test, "myargs", {}) - @instance.send(method, :test, "myargs") + subject.indirection.expects(method).with(:test, "myargs") + subject.send(method, :test, "myargs") end end |
