Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.62 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Why tag lib test throws GrailsTagException?
  2. class MyTagLib {
  3.  
  4.   def something = {attrs, body ->
  5.     def format = new FormatTagLib()
  6.     out << format.formatDate(attrs.date, format: 'HH:mm')
  7.   }
  8.  
  9. }
  10.        
  11. class MyTagLibTests extends TagLibUnitTestCase {
  12.  
  13.   //setUp() and tearDown() ommited
  14.  
  15.   void testMyTagLib() {
  16.     tagLib = new MyTagLib()
  17.     tagLib.something(date: Date.parse('20/04/2012 08:00','dd/MM/yyyy HH:mm'))
  18.     assertEquals('08:00', out.toString()) //out is mocked...
  19.   }
  20.  
  21. }
  22.        
  23. org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Tag [formatDate] does not exist. No corresponding tag library found.