Groovy Documentation

grails.test
[Groovy] Class GroovyPagesTestCase

java.lang.Object
  GroovyTestCase
      grails.test.GroovyPagesTestCase

class GroovyPagesTestCase
extends GroovyTestCase

A test harness that eases testing of GSP and tag libraries for Grails.

Authors:
Graeme Rocher


Property Summary
GroovyPagesTemplateEngine groovyPagesTemplateEngine

The GroovyPagesTemplateEngine which gets wired into this GSP.

 
Method Summary
java.lang.String applyTemplate(java.lang.Object template, java.lang.Object params = [:])

Applies a GSP template and returns its output as a String.

void applyTemplate(java.io.StringWriter sw, java.lang.Object template, java.lang.Object params = [:])

void assertOutputEquals(java.lang.Object expected, java.lang.Object template, java.lang.Object params = [:], groovy.lang.Closure transform = { it.toString()

Asserts the output of a given template against the specified expected value.

void setControllerName(java.lang.String name)

Sets the controller name to use.

 

Property Detail

groovyPagesTemplateEngine

GroovyPagesTemplateEngine groovyPagesTemplateEngine
The GroovyPagesTemplateEngine which gets wired into this GSP.


 
Method Detail

applyTemplate

java.lang.String applyTemplate(java.lang.Object template, java.lang.Object params = [:])
Applies a GSP template and returns its output as a String.
Parameters:
template - The GSP template
params - An optional parameter that allows the specification of the binding


applyTemplate

void applyTemplate(java.io.StringWriter sw, java.lang.Object template, java.lang.Object params = [:])


assertOutputEquals

void assertOutputEquals(java.lang.Object expected, java.lang.Object template, java.lang.Object params = [:], groovy.lang.Closure transform = { it.toString()
Asserts the output of a given template against the specified expected value.
Parameters:
expected - The expected output
template - A snippet of GSP
params - An optional parameter that allows variables to be placed in the binding of the GSP
transform - An optional parameter that allows the specification of a closure to transform the passed StringWriter


setControllerName

void setControllerName(java.lang.String name)
Sets the controller name to use. Should be called to override the defaut "test" value.


 

Groovy Documentation