Skip to content

Instantly share code, notes, and snippets.

@alvarosanchez
Created June 2, 2014 00:08
Show Gist options
  • Save alvarosanchez/8b76254c636d00301a96 to your computer and use it in GitHub Desktop.
Save alvarosanchez/8b76254c636d00301a96 to your computer and use it in GitHub Desktop.
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