This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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) |
This file contains hidden or 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
| # 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) |