Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
@mbleigh
mbleigh / gist:1384828
Created November 22, 2011 03:39 — forked from jch/gist:1384826
Object.pathy!
def response
last_response.stub!(:parsed_body).and_return(MultiJson.decode(last_response.body))
last_response
end
def body(path = nil)
if path
response.parsed_body.at_json_path(path)
class API < Grape::API
version '1'
end
Rack::Builder.new do
use Rack::Cors do |config|
config.allow do |allow|
allow.origins '*'
allow.resource '*', :headers => :any
end
# I hear that aliasing lambda is bad, but this is
# much more readable...
alias :this_block :lambda
this_block{ @this.destroy }.should change(Thing, :count).by(-1)