summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-24 20:54:47 -0500
committerLuke Kanies <luke@madstop.com>2008-08-26 22:40:41 -0700
commit30dea6839b0360e2fabbeb833e6c2b8658d3f53c (patch)
tree0be9491fa9a5aee7137925731f6e9df6269941ca /spec
parent40e76fb83ef466425fec736abbf1913a6426bf01 (diff)
Adding a 'plural?' method to the Indirection::Request class.
I'm in the process of creating a new service for handling all of the http calls, including generation of the RESTian URL. This service obviously needs to know whether the url should be plural or singular, and the request knows the method in use, so it can easily answer the question. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/indirector/request.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/indirector/request.rb b/spec/unit/indirector/request.rb
index 6169a09b4..18f625946 100755
--- a/spec/unit/indirector/request.rb
+++ b/spec/unit/indirector/request.rb
@@ -135,4 +135,16 @@ describe Puppet::Indirector::Request do
request.indirection.should equal(ind)
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
+
+ it "should be considered plural if the method is 'search'" do
+ Puppet::Indirector::Request.new(:myind, :search, :key).should be_plural
+ end
+
+ it "should not be considered plural if the method is not 'search'" do
+ Puppet::Indirector::Request.new(:myind, :find, :key).should_not be_plural
+ end
end