Created
April 6, 2012 00:35
-
-
Save oestrich/2315434 to your computer and use it in GitHub Desktop.
RspecApiDocumentation Send JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "Order" do | |
let(:client) { RspecApiDocumentation::TestClient.new(self, :headers => { "HTTP_ACCEPT" => "application/json", "CONTENT_TYPE" => "application/json" }) } | |
post "/orders" do | |
parameter :name, "Order name" | |
let(:name) { "New order" } | |
let(:raw_post) { params.to_json } | |
example "Sending JSON" do | |
do_request | |
response_body.should be_json_eql({ :name => name }.to_json) | |
status.should == 201 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment