Skip to content

Instantly share code, notes, and snippets.

@oestrich
Created April 6, 2012 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oestrich/2315434 to your computer and use it in GitHub Desktop.
Save oestrich/2315434 to your computer and use it in GitHub Desktop.
RspecApiDocumentation Send JSON
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