Skip to content

Commit

Permalink
Assert the proper status code for PUT
Browse files Browse the repository at this point in the history
See https://tools.ietf.org/html/rfc7231#section-4.3.4

Money quote:

    If the target resource does not have a current representation and the
    PUT successfully creates one, then the origin server MUST inform the
    user agent by sending a 201 (Created) response.  If the target
    resource does have a current representation and that representation
    is successfully modified in accordance with the state of the enclosed
    representation, then the origin server MUST send either a 200 (OK) or
    a 204 (No Content) response to indicate successful completion of the
    request.
  • Loading branch information
untitaker committed Jun 11, 2016
1 parent b7b77c7 commit 889ec7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def check_dir_listing_content_type(content_type)
end

it "works" do
[200, 201].must_include @res.code
@res.code.must_equal 201
@res.headers[:etag].wont_be_nil
@res.headers[:etag].must_be_etag
end
Expand Down Expand Up @@ -101,7 +101,7 @@ def check_dir_listing_content_type(content_type)

it "works" do
# before runs for each block once, so we have to put all blocks into one
[200, 201].must_include @res.code
[204, 200].must_include @res.code
@item_etag.wont_be_nil
@item_etag.must_be_etag

Expand Down

0 comments on commit 889ec7d

Please sign in to comment.