Skip to content

Instantly share code, notes, and snippets.

@bmentges
Last active August 29, 2015 14:14
Show Gist options
  • Save bmentges/e39d82e1f8df2e2907b9 to your computer and use it in GitHub Desktop.
Save bmentges/e39d82e1f8df2e2907b9 to your computer and use it in GitHub Desktop.
post-test-grails-controller-1
// A classe do controller:
Class SimpleController {
def index() {
render "hello"
}
}
// O teste
import grails.test.mixin.TestFor
import spock.lang.Specification
@TestFor(SimpleController)
class SimpleControllerSpec extends Specification {
void "test hello"() {
when:
controller.index()
then:
response.text == 'hello'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment