Skip to content

Instantly share code, notes, and snippets.

@jasongonzales23
Created August 2, 2012 19:36
Show Gist options
  • Save jasongonzales23/3239989 to your computer and use it in GitHub Desktop.
Save jasongonzales23/3239989 to your computer and use it in GitHub Desktop.
Testing GSP's with GroovyPagesTestCase

Here's what it looks like

import grails.test.GroovyPagesTestCase class ReceiptAttacherTest extends GroovyPagesTestCase { def lineItemModelService def receiptService void testAttachReceiptFromCreateOrItemizeModal_AttachmentShouldOpenInNewWindow() { //given def file = new File("grails-app/views/receipt/_drawerReceipt.gsp") //when def result = applyTemplate(file.text, [ item: [ lineItemId: 1234, receipt: [ attached: true, mediaType: 'image/jpeg', originalUri: 'some/path', receiptId: 5678, name: 'jason' ] ] ]) //then assertTrue(result.contains('target="_blank"')) }}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment