Created
March 28, 2014 15:16
-
-
Save sharnik/9835178 to your computer and use it in GitHub Desktop.
rspec_api_documentation usage example
This file contains 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 FancyAPI < API | |
patch '/:id' do | |
object = FancyObject.find(params[:id]) | |
object.update(params[:fancy_object] | |
object.to_json | |
end | |
end |
This file contains 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
resource "FancyObject" do | |
set_app FancyAPI | |
before { @object = FancyObject.create(default_params) } | |
patch '/:id' do | |
example_request 'Updating the object', id: @object.id do | |
expect(status).to == 200 | |
expect(JSON.parse(response_body)['my_fancy_field']).to == 'fancy value' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment