summaryrefslogtreecommitdiffstats
path: root/spec/unit/indirector
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-30 23:19:08 -0500
committerLuke Kanies <luke@madstop.com>2008-07-30 23:19:08 -0500
commitc2c8941de5973137d631c1f90f7c07e54cc89e3d (patch)
tree1a7ab7d4242ca47b7c851d4a7463a23771c439d1 /spec/unit/indirector
parent186f3cd34fb7fa3bc1ff683a5178444526259f92 (diff)
downloadpuppet-c2c8941de5973137d631c1f90f7c07e54cc89e3d.tar.gz
puppet-c2c8941de5973137d631c1f90f7c07e54cc89e3d.tar.xz
puppet-c2c8941de5973137d631c1f90f7c07e54cc89e3d.zip
Correctly handling when REST searches return nothing.
We return a 404, which the client can correctly handle. That wasn't the actual problem causing failing tests, of course -- the problem was that one side of our stub was autodetecting marshal, and the other side was forcing yaml, which strangely didn't work. It was only happening with searching, though, not finding et al. The 'search returning nil' problem was a bit of a red herring but needed to be fixed, too. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/indirector')
-rwxr-xr-xspec/unit/indirector/rest.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/unit/indirector/rest.rb b/spec/unit/indirector/rest.rb
index 801e8888e..28ceb693a 100755
--- a/spec/unit/indirector/rest.rb
+++ b/spec/unit/indirector/rest.rb
@@ -187,6 +187,12 @@ describe Puppet::Indirector::REST do
@searcher.search(@request)
end
+ it "should return an empty array if serialization returns nil" do
+ @model.stubs(:convert_from_multiple).returns nil
+
+ @searcher.search(@request).should == []
+ end
+
it "should generate an error when result data deserializes fails" do
@searcher.expects(:deserialize).raises(ArgumentError)
lambda { @searcher.search(@request) }.should raise_error(ArgumentError)