summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/http/api
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-02-18 15:19:46 -0800
committerMax Martin <max@puppetlabs.com>2011-02-18 15:19:46 -0800
commitd1f1858ea52d3089fd2088994e80d6f49d7e0347 (patch)
tree7e4421582c3080611a0184033cff0cade2508d80 /spec/unit/network/http/api
parent12fd75a7c575ea181f065b6aaffdcb65417aeb35 (diff)
downloadpuppet-d1f1858ea52d3089fd2088994e80d6f49d7e0347.tar.gz
puppet-d1f1858ea52d3089fd2088994e80d6f49d7e0347.tar.xz
puppet-d1f1858ea52d3089fd2088994e80d6f49d7e0347.zip
(#6376) Add support and testing for _search GET requests
Added support for adding "_search" to the end of any indirection to 'pluralize' it, and added tests to check this functionality and to test hidden side effect of plurality method unpluralizing indirections. Paired-With:Paul Berry <paul@puppetlabs.com>
Diffstat (limited to 'spec/unit/network/http/api')
-rw-r--r--spec/unit/network/http/api/v1_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb
index d47fc8d81..e7348312b 100644
--- a/spec/unit/network/http/api/v1_spec.rb
+++ b/spec/unit/network/http/api/v1_spec.rb
@@ -88,6 +88,18 @@ describe Puppet::Network::HTTP::API::V1 do
@tester.uri2indirection("GET", "/env/inventory/search", {}).method.should == :search
end
+ it "should choose 'search' as the indirection method if the http method is a GET and the indirection name is facts_search" do
+ @tester.uri2indirection("GET", "/env/facts_search/bar", {}).method.should == :search
+ end
+
+ it "should change indirection name to 'facts' if the http method is a GET and the indirection name is facts_search" do
+ @tester.uri2indirection("GET", "/env/facts_search/bar", {}).indirection_name.should == :facts
+ end
+
+ it "should change indirection name to 'status' if the http method is a GEt and the indirection name is statuses" do
+ @tester.uri2indirection("GET", "/env/statuses/bar", {}).indirection_name.should == :status
+ end
+
it "should choose 'delete' as the indirection method if the http method is a DELETE and the indirection name is singular" do
@tester.uri2indirection("DELETE", "/env/foo/bar", {}).method.should == :destroy
end