Skip to content

Instantly share code, notes, and snippets.

@ishults
Created February 21, 2016 17:57
Show Gist options
  • Save ishults/a071e657b42ef04e8e72 to your computer and use it in GitHub Desktop.
Save ishults/a071e657b42ef04e8e72 to your computer and use it in GitHub Desktop.
The broken unit tests for our filter
@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"() {
when:
withFilters(uri: '/some/path/**') { 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