Groovy Documentation

grails.plugin.spock
[Groovy] Class ControllerSpec

java.lang.Object
  spock.lang.Specification
      grails.plugin.spock.UnitSpec
          grails.plugin.spock.MvcSpec
              grails.plugin.spock.ControllerSpec

class ControllerSpec
extends MvcSpec

Support class for writing unit tests for controllers. Its main job is to mock the various properties and methods that Grails injects into controllers. By default it determines what controller to mock based on the name of the test, but this can be overridden by one of the constructors.

Authors:
Graeme Rocher
Peter Ledbrook


Field Summary
 
Fields inherited from class MvcSpec
webRequest
 
Fields inherited from class UnitSpec
errorsMap
 
Method Summary
java.lang.Object getChainArgs()

java.lang.Object getController()

java.lang.Object getControllerClass()

java.lang.Object getForwardArgs()

java.lang.Object getRedirectArgs()

java.lang.Object initializeMvcMocking(java.lang.Class classUnderTest)

protected java.lang.Object mockCommandObject(java.lang.Class clazz)

java.lang.Object provideMvcClassUnderTest()

void reset()

protected void setXmlRequestContent(java.lang.Object content)

protected void setXmlRequestContent(java.lang.String encoding, java.lang.Object content)

java.lang.Object setup()

 
Methods inherited from class MvcSpec
findClassUnderTestConventiallyBySuffix, getMockFlash, getMockParams, getMockRequest, getMockResponse, getMockSession, getRenderArgs, initializeMvcMocking, provideMvcClassUnderTest, reset, setup, setupSpec
 
Methods inherited from class UnitSpec
addConverters, cleanup, cleanupSpec, enableCascadingValidation, loadCodec, mockConfig, mockController, mockDomain, mockFor, mockForConstraintsTests, mockLogging, mockTagLib, registerMetaClass, setup, setupSpec
 

Method Detail

getChainArgs

java.lang.Object getChainArgs()


getController

java.lang.Object getController()


getControllerClass

java.lang.Object getControllerClass()


getForwardArgs

java.lang.Object getForwardArgs()


getRedirectArgs

java.lang.Object getRedirectArgs()


initializeMvcMocking

java.lang.Object initializeMvcMocking(java.lang.Class classUnderTest)


mockCommandObject

protected java.lang.Object mockCommandObject(java.lang.Class clazz)


provideMvcClassUnderTest

java.lang.Object provideMvcClassUnderTest()


reset

void reset()


setXmlRequestContent

protected void setXmlRequestContent(java.lang.Object content)


setXmlRequestContent

protected void setXmlRequestContent(java.lang.String encoding, java.lang.Object content)


setup

java.lang.Object setup()


 

Groovy Documentation