org.grails.testing.spock.WebTestingSupportExtension.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grails-web-testing-support Show documentation
Show all versions of grails-web-testing-support Show documentation
Support for writing concise expressive tests for Grails artifacts
package org.grails.testing.spock
import grails.testing.web.GrailsWebUnitTest
import grails.testing.web.UrlMappingsUnitTest
import grails.testing.web.interceptor.InterceptorUnitTest
import groovy.transform.CompileStatic
import org.spockframework.runtime.extension.AbstractGlobalExtension
import org.spockframework.runtime.model.SpecInfo
@CompileStatic
class WebTestingSupportExtension extends AbstractGlobalExtension {
WebSetupSpecInterceptor webSetupSpecInterceptor = new WebSetupSpecInterceptor()
WebSetupInterceptor webSetupInterceptor = new WebSetupInterceptor()
WebCleanupInterceptor webCleanupInterceptor = new WebCleanupInterceptor()
WebCleanupSpecInterceptor webCleanupSpecInterceptor = new WebCleanupSpecInterceptor()
UrlMappingSetupSpecInterceptor urlMappingSetupSpecInterceptor = new UrlMappingSetupSpecInterceptor()
InterceptorSetupSpecInterceptor interceptorSetupSpecInterceptor = new InterceptorSetupSpecInterceptor()
void visitSpec(SpecInfo spec) {
if (GrailsWebUnitTest.isAssignableFrom(spec.reflection)) {
spec.addSetupSpecInterceptor(webSetupSpecInterceptor)
spec.addSetupInterceptor(webSetupInterceptor)
spec.addCleanupInterceptor(webCleanupInterceptor)
spec.addCleanupSpecInterceptor(webCleanupSpecInterceptor)
}
if (UrlMappingsUnitTest.isAssignableFrom(spec.reflection)) {
spec.addSetupSpecInterceptor(urlMappingSetupSpecInterceptor)
}
if (InterceptorUnitTest.isAssignableFrom(spec.reflection)) {
spec.addSetupSpecInterceptor(interceptorSetupSpecInterceptor)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy