Created
February 21, 2016 18:05
-
-
Save ishults/594a1d9a266fbb645d8d to your computer and use it in GitHub Desktop.
The working filter unit tests
This file contains 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
@Mock(UriFilters) | |
@TestFor(MyController)// Need a controller to test filters | |
class UriFiltersSpec extends Specification { | |
void "myFilter() should set the names of the controller and action"() { | |
setup: | |
request.requestURI = '/some/path/here' | |
when: | |
withFilters(controller: 'my', action: 'index') { controller.index() } | |
then: | |
response.getHeader('controllerName') == 'my' | |
response.getHeader('actionName') == 'index' | |
response.contentAsString == 'success' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment