Created
June 2, 2014 00:08
-
-
Save alvarosanchez/8b76254c636d00301a96 to your computer and use it in GitHub Desktop.
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
def "it creates games"() { | |
when: | |
Response response = restClient.post(path: "/games") { | |
json name:"New game" | |
} | |
then: | |
response.statusCode == 201 | |
response.headers['Location'] | |
} | |
def "it modifies games"() { | |
when: | |
restClient.put(path: "/games/6") { | |
json name:"New game, modified" | |
} | |
and: | |
Response response = restClient.get(path: "/games/6", accept: ContentType.JSON) | |
then: | |
response.statusCode == 200 | |
response.json.name == "New game, modified" | |
} | |
def "it removes games"() { | |
when: | |
Response response = restClient.delete(path: "/games/6") | |
then: | |
response.statusCode == 204 | |
when: | |
restClient.get(path: "/games/6", accept: ContentType.JSON) | |
then: | |
RESTClientException e = thrown(RESTClientException) | |
e.response.statusCode == 404 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment