Skip to content

Instantly share code, notes, and snippets.

@szmeku
Last active August 29, 2015 13:57
Show Gist options
  • Save szmeku/9713962 to your computer and use it in GitHub Desktop.
Save szmeku/9713962 to your computer and use it in GitHub Desktop.
Feature: Venues actions
Background:
Given the following venues exist:
| id | name | email | description | city | street | telephone |
| 555 | Hi Five Venue | [email protected] | bla bla bla | Somewhercity | bla | 32423 |
| 666 | Satan Venue | [email protected] | bla bla bla | Somewhercity | bla | 32423 |
Scenario: Get one venue
When I visit venues/555
Then response should be ok
And the JSON should have the following:
| id | "555" |
| name | "Hi Five Venue" |
Scenario: Get all venues
When I visit venues
Then response should be ok
And the JSON should be an array
And the JSON should have 4 entries
And the JSON should have the following:
| 2/name | "Hi Five Venue" |
| 3/name | "Satan Venue" |
Scenario: Can't get non-existent venue
When I visit venues/1000
Then response should be not found
And the JSON at "messages/0" should be "Venue doesn't exist"
Scenario: Update venue
When I put to venues/555 following:
| name | email |
| Hi Five Venue Updated | [email protected] |
Then response should be ok
And the JSON should have the following:
| id | "555" |
| name | "Hi Five Venue Updated" |
| email | "[email protected]" |
Scenario: Can't update non-existent venue
When I put to venues/1000 following:
| name | email |
| some data | some data |
Then response should be not found
And the JSON at "messages/0" should be "Venue doesn't exist"
Scenario: Some fields are required, ie. can't update sending empty street and city
When I put to venues/555 following:
| id | street | city |
| 555 | | |
Then response should be bad request
And the JSON at "messages" should have the following:
| 0 | "The city field is required." |
| 1 | "The street field is required." |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment