diff options
| author | Luke Kanies <luke@madstop.com> | 2008-07-28 11:23:08 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-07-29 00:51:22 -0500 |
| commit | 4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4 (patch) | |
| tree | 50f6c0ef591867bafe4ac9ea3c3f64d045bec573 /spec/unit/network/http/webrick | |
| parent | e3350caeec3a662b0b92ec2dee372563a493fa11 (diff) | |
| download | puppet-4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4.tar.gz puppet-4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4.tar.xz puppet-4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4.zip | |
All error and format handling works over REST except searching.
Searching operates on multiple instances, and I have not
yet figured out how we should handle converting multiple
instances to a given format -- we can't use the instance
method (e.g., to_yaml), because it would be on Array
instead of the class we're operating on. That would work
for yaml, but not, for instance, for xml.
Diffstat (limited to 'spec/unit/network/http/webrick')
| -rwxr-xr-x | spec/unit/network/http/webrick/rest.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/unit/network/http/webrick/rest.rb b/spec/unit/network/http/webrick/rest.rb index b42053d53..4c72ec545 100755 --- a/spec/unit/network/http/webrick/rest.rb +++ b/spec/unit/network/http/webrick/rest.rb @@ -33,7 +33,7 @@ describe Puppet::Network::HTTP::WEBrickREST do describe "when using the Handler interface" do it "should use the 'accept' request parameter as the Accept header" do - @request.expects(:[]).with(:accept).returns "foobar" + @request.expects(:[]).with("accept").returns "foobar" @handler.accept_header(@request).should == "foobar" end @@ -57,17 +57,24 @@ describe Puppet::Network::HTTP::WEBrickREST do @handler.body(@request).should == "my body" end - it "should set the response's :content_type header when setting the content type" do - @response.expects(:[]=).with(:content_type, "text/html") + it "should set the response's 'content-type' header when setting the content type" do + @response.expects(:[]=).with("content-type", "text/html") @handler.set_content_type(@response, "text/html") end - it "should set the status and body on the response when setting the response" do + it "should set the status and body on the response when setting the response for a successful query" do @response.expects(:status=).with 200 @response.expects(:body=).with "mybody" @handler.set_response(@response, "mybody", 200) end + + it "should set the status and message on the response when setting the response for a failed query" do + @response.expects(:status=).with 400 + @response.expects(:reason_phrase=).with "mybody" + + @handler.set_response(@response, "mybody", 400) + end end describe "and determining the request parameters" do |
