*Unit vs. Integration Tests *Why and When to Test? *Anatomy of a Test *Assertions *Passing Models
/* RC_LEGAL_LEGEND */
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"'))
}
}