Last active
August 29, 2015 14:14
-
-
Save bmentges/e39d82e1f8df2e2907b9 to your computer and use it in GitHub Desktop.
post-test-grails-controller-1
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
// 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