Skip to content

Instantly share code, notes, and snippets.

@chbatey
Created February 14, 2014 02:25
Show Gist options
  • Select an option

  • Save chbatey/8994751 to your computer and use it in GitHub Desktop.

Select an option

Save chbatey/8994751 to your computer and use it in GitHub Desktop.
Spock: Testing a web application
class ExampleWebAppSpecification extends Specification {
def "Should return 200 & a message with the input appended"() {
setup:
def primerEndpoint = new RESTClient( 'http://localhost:8080/' )
when:
def resp = primerEndpoint.get([ path: 'exampleendpoint', query : [ input : 'Get a hair cut' ]])
then:
with(resp) {
status == 200
contentType == "application/json"
}
with(resp.data) {
payload == "Something really important: Get a hair cut"
}
}
}
@epdjeordjian
Copy link
Copy Markdown

Thank you for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment