Sha256: 271759581aeb304a8f8a638f311c1c13747c2724dd4540eef8a9c20f37ba61b4
Contents?: true
Size: 685 Bytes
Versions: 9
Compression:
Stored size: 685 Bytes
Contents
require "spec_helper" describe Rack::API, "HTTP Methods" do before do Rack::API.app do version :v1 do get("get") { {:get => true} } post("post") { {:post => true} } put("put") { {:put => true} } delete("delete") { {:delete => true} } head("head") { {:head => true} } end end end Rack::API::Runner::HTTP_METHODS.each do |method| it "renders #{method}" do send method, "/v1/#{method}" last_response.status.should == 200 last_response.body.should == {method => true}.to_json end end it "does not render unknown methods" do post "/get" last_response.status.should == 404 end end
Version data entries
9 entries across 9 versions & 1 rubygems