Created
February 17, 2012 01:38
-
-
Save isaacsanders/1849677 to your computer and use it in GitHub Desktop.
RESTful API example
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
Feature: RESTful JSON Pages API | |
In order to interact with my information in different stacks | |
I want to interact with a RESTful JSON API. | |
Scenario: GET /api/pages | |
Given I have pages in my database | |
When I make an HTTP GET request to /api/pages | |
Then I see a JSON array of pages | |
Scenario: POST /api/pages | |
Given I have content for a page | |
When I make an HTTP POST request to /api/pages with my content as the body | |
Then I should see a URI to the page I just created | |
Scenario: GET /api/pages/:id | |
Given I know the id of the page I am looking for | |
When I make an HTTP GET request to /api/pages/:id | |
Then I should see a JSON object with the page's data | |
And I should see the HATEOAS of that page | |
Scenario: PUT /api/pages/:id | |
Given I know the id of the page I am looking for | |
And I have content for a page | |
When I make an HTTP PUT request to /api/pages/:id with my content as the body | |
Then I should see a URI to the page I just created | |
Scenario: POST /api/pages/:id | |
Given there is a page with content at the given URI | |
And I have edited content for the page | |
When I make an HTTP POST request to /api/pages/:id with my content as the body | |
Then I should see a URI to the page I just created |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment