(grails) encodeAsHTML metod not found in the unit test the taglib

if in the taglib test use add it the metalib method

 

  void setUp() {
    super.setUp()
    String.metaclass.encodeAsHTML = {
      org.codehaus.groovy.grails.plugins.codecs.HTMLCodec.encode(delegate)
    }
  }

 

if in the controller test can use above method or use the load code method

 

  void setUp() {
    super.setUp()
    loadCode(org.codehaus.groovy.grails.plugins.codecs.HTMLCodec)
  }


reference: http://kousenit.wordpress.com/2010/02/24/using-a-codec-in-a-grails-unit-test/

 

你可能感兴趣的:(wordpress,grails,groovy)