Skip to content

Instantly share code, notes, and snippets.

@berngp
Created April 22, 2011 01:33
Show Gist options
  • Save berngp/935846 to your computer and use it in GitHub Desktop.
Save berngp/935846 to your computer and use it in GitHub Desktop.
Missing renderer for Unit Testing within Grails
controller.metaClass.render = {Map map, Closure closure ->
renderArgs.putAll(map)
switch(map.contentType) {
case null:
break
case 'application/xml':
case 'text/xml':
def smb = new StreamingMarkupBuilder()
if (map.encoding){
smb.encoding = map.encoding
}
delegate.response.outputStream << smb.bind(closure)
break
case 'text/json':
new JSonBuilder(delegate.response).json(closure)
break
default:
println 'Nothing!!'
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment