Skip to content

Instantly share code, notes, and snippets.

@d11wtq
Created October 22, 2011 06:01
Show Gist options
  • Save d11wtq/1305700 to your computer and use it in GitHub Desktop.
Save d11wtq/1305700 to your computer and use it in GitHub Desktop.
context "given a simple model" do
let(:model) do
Class.new do
def self.name
"Customer"
end
include DataMapper::Resource
property :id, DataMapper::Property::Serial
property :name, DataMapper::Property::String
end.tap { |m| m.auto_migrate! && m.finalize }
end
it "generates a route for the collection" do
get "/customers"
last_response.status.should == 200
end
it "generates a routes to create resources" do
post "/customers", '{"name":"Bob"}', "CONTENT_TYPE" => "application/json"
last_response.status.should == 201
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment