Signed-off-by: Luke Kanies <[email protected]>
---
spec/unit/indirector/rest.rb | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/spec/unit/indirector/rest.rb b/spec/unit/indirector/rest.rb
index 8ed50d3..8710d77 100755
--- a/spec/unit/indirector/rest.rb
+++ b/spec/unit/indirector/rest.rb
@@ -244,6 +244,12 @@ describe Puppet::Indirector::REST do
@searcher.find(@request)
end
+ it "should include the query string" do
+ @searcher.expects(:query_string).with(@request).returns
"?my_string"
+ @connection.expects(:get).with { |path, args|
path.include?("?my_string") }.returns(@response)
+ @searcher.find(@request)
+ end
+
it "should provide an Accept header containing the list of supported
formats joined with commas" do
@connection.expects(:get).with { |path, args| args["Accept"] ==
"supported, formats" }.returns(@response)
@@ -298,11 +304,9 @@ describe Puppet::Indirector::REST do
@searcher.search(@request)
end
- it "should include all options in the query string" do
- @request.stubs(:options).returns(:one => "two", :three => "four")
-
- should_path = "/%s/%s" % [[email protected]_s, "foo"]
- @connection.expects(:get).with { |path, args| path =~
/\?one=two&three=four$/ or path =~ /\?three=four&one=two$/ }.returns(@response)
+ it "should include the query string" do
+ @searcher.expects(:query_string).with(@request).returns
"?my_string"
+ @connection.expects(:get).with { |path, args|
path.include?("?my_string") }.returns(@response)
@searcher.search(@request)
end
@@ -358,6 +362,12 @@ describe Puppet::Indirector::REST do
@searcher.destroy(@request)
end
+ it "should not include the query string" do
+ @searcher.expects(:query_string).never
+ @connection.stubs(:delete).returns @response
+ @searcher.destroy(@request)
+ end
+
it "should provide an Accept header containing the list of supported
formats joined with commas" do
@connection.expects(:delete).with { |path, args| args["Accept"] ==
"supported, formats" }.returns(@response)
@@ -403,6 +413,12 @@ describe Puppet::Indirector::REST do
@searcher.save(@request)
end
+ it "should not include the query string" do
+ @searcher.expects(:query_string).never
+ @connection.stubs(:put).returns @response
+ @searcher.save(@request)
+ end
+
it "should serialize the instance using the default format and pass
the result as the body of the request" do
@instance.expects(:render).returns "serial_instance"
@connection.expects(:put).with { |path, data, args| data ==
"serial_instance" }.returns @response
--
1.6.1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---