Closed herrvendil closed 12 years ago
Sorry for the bad formatting, but i cannot find any way to attach text files to the issue.
It should be a capital M on Mock(Resource)
Good,thank you for your contribution.I will merge it in v0.5.1
BTW,you can contribute your code by pull requests.
0.5.1 Release,but remove the "extends GrailsUnitTestMixin" that not support for grails 1.3.7
Hi
First of all thanks for a great plug-in.
But I've been having trouble with performing unit + integration tests with mocked domain classes in Grails 2.0.x, When testing a composer I have been using the old mockDomain way, but that seems to break other unit tests that uses the never TestMixin way of Mocking.
I have written my own version of ComposerUnitTestMixin that works for me. I may need some improvements before it can be generally used but it maybe of some help to others in doing this kind of test suite as well.
The code is:
package grails.test.mixin.web
import grails.artefact.Enhanced; import grails.test.ComposerMockUtils; import grails.test.mixin.support.GrailsUnitTestMixin import groovy.lang.MetaClass; import org.codehaus.groovy.grails.commons.metaclass.MetaClassEnhancer
/**
@author Philip Vendil Mar 24, 2012 / class ComposerUnitTestMixin extends GrailsUnitTestMixin {
def T mockComposer(Class composerClass) {
}
}
And in the test scripts I have used the following header: import grails.test.mixin. import grails.test.mixin.support. import grails.test.mixin.web.ComposerUnitTestMixin
@TestMixin(ComposerUnitTestMixin) @Mock(Resource) class MainComposerTests { ....
}