diff options
author | Luke Kanies <luke@madstop.com> | 2009-03-13 18:38:55 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-03-20 18:27:08 +1100 |
commit | 97975e14acfc8c62488a2e6495ca00d426bc9290 (patch) | |
tree | ef745a24c1c43a14f8f404ab2d077e92661509a7 /spec | |
parent | b6116fe28d9c771dbe2dcded539bcf30eea552a3 (diff) | |
download | puppet-97975e14acfc8c62488a2e6495ca00d426bc9290.tar.gz puppet-97975e14acfc8c62488a2e6495ca00d426bc9290.tar.xz puppet-97975e14acfc8c62488a2e6495ca00d426bc9290.zip |
Adding a model accessor to the Request class
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/indirector/request.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/unit/indirector/request.rb b/spec/unit/indirector/request.rb index 241f5f9fc..e2a871a5f 100755 --- a/spec/unit/indirector/request.rb +++ b/spec/unit/indirector/request.rb @@ -158,6 +158,23 @@ describe Puppet::Indirector::Request do request.indirection.should equal(ind) end + it "should use its indirection to look up the appropriate model" do + ind = mock 'indirection' + Puppet::Indirector::Indirection.expects(:instance).with(:myind).returns ind + request = Puppet::Indirector::Request.new(:myind, :method, :key) + + ind.expects(:model).returns "mymodel" + + request.model.should == "mymodel" + end + + it "should fail intelligently when asked to find a model but the indirection cannot be found" do + Puppet::Indirector::Indirection.expects(:instance).with(:myind).returns nil + request = Puppet::Indirector::Request.new(:myind, :method, :key) + + lambda { request.model }.should raise_error(ArgumentError) + end + it "should have a method for determining if the request is plural or singular" do Puppet::Indirector::Request.new(:myind, :method, :key).should respond_to(:plural?) end |