Created
February 14, 2014 02:25
-
-
Save chbatey/8994751 to your computer and use it in GitHub Desktop.
Spock: Testing a web application
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
| 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" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing!