Permalink
Browse files

Convert tests to use the new testing framework

  • Loading branch information...
jameskleeh committed Jun 15, 2017
1 parent aed4c14 commit 8c4f07743108bf1e4e5f69dbb57695cce0b2518d
Showing with 2,253 additions and 2,197 deletions.
  1. +0 −1 grails-test-suite-base/build.gradle
  2. +7 −1 grails-test-suite-persistence/build.gradle
  3. +2 −3 grails-test-suite-persistence/src/test/groovy/grails/gorm/criteri/WithCriteriaReadOnlySpec.groovy
  4. +1 −1 ...ite-persistence/src/test/groovy/grails/gorm/transactional/TransactionalIntegrationTestSpec.groovy
  5. +10 −9 ...t-suite-persistence/src/test/groovy/grails/test/mixin/domain/DomainClassUnitTestMixinTests.groovy
  6. +2 −3 grails-test-suite-persistence/src/test/groovy/grails/test/mixin/domain/SaveDomainSpec.groovy
  7. +3 −8 ...suite-persistence/src/test/groovy/grails/web/databinding/GrailsWebDataBinderBindingXmlSpec.groovy
  8. +3 −6 ...te-persistence/src/test/groovy/grails/web/databinding/GrailsWebDataBinderConfigurationSpec.groovy
  9. +4 −8 grails-test-suite-persistence/src/test/groovy/grails/web/databinding/GrailsWebDataBinderSpec.groovy
  10. +12 −2 grails-test-suite-uber/build.gradle
  11. +12 −6 grails-test-suite-uber/src/test/groovy/grails/test/mixin/AddToAndServiceInjectionTests.groovy
  12. +85 −96 ...-test-suite-uber/src/test/groovy/grails/test/mixin/AstEnhancedControllerUnitTestMixinTests.groovy
  13. +11 −6 grails-test-suite-uber/src/test/groovy/grails/test/mixin/AutowireServiceViaDefineBeansTests.groovy
  14. +9 −5 grails-test-suite-uber/src/test/groovy/grails/test/mixin/BidirectionalOneToManyUnitTestTests.groovy
  15. +6 −3 grails-test-suite-uber/src/test/groovy/grails/test/mixin/CascadeValidationForEmbeddedSpec.groovy
  16. +7 −8 grails-test-suite-uber/src/test/groovy/grails/test/mixin/ControllerAndGroovyPageMixinTests.groovy
  17. +6 −2 ...est-suite-uber/src/test/groovy/grails/test/mixin/ControllerMockWithMultipleControllersSpec.groovy
  18. +18 −12 grails-test-suite-uber/src/test/groovy/grails/test/mixin/ControllerTestForTests.groovy
  19. +243 −148 grails-test-suite-uber/src/test/groovy/grails/test/mixin/ControllerUnitTestMixinTests.groovy
  20. +11 −4 grails-test-suite-uber/src/test/groovy/grails/test/mixin/ControllerWithMockCollabTests.groovy
  21. +7 −10 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassAnnotatedSetupMethodTests.groovy
  22. +118 −80 ...-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassControllerUnitTestMixinTests.groovy
  23. +5 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassDeepValidationSpec.groovy
  24. +0 −36 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassMetaClassCleanupSpec.groovy
  25. +7 −7 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassSetupMethodTests.groovy
  26. +3 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassWithAutoTimestampSpec.groovy
  27. +9 −4 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassWithCustomValidatorTests.groovy
  28. +11 −10 ...uber/src/test/groovy/grails/test/mixin/DomainClassWithDefaultConstraintsUnitTestMixinTests.groovy
  29. +2 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/DomainClassWithUniqueConstraintSpec.groovy
  30. +37 −25 grails-test-suite-uber/src/test/groovy/grails/test/mixin/GroovyPageUnitTestMixinTests.groovy
  31. +4 −5 ...-suite-uber/src/test/groovy/grails/test/mixin/GroovyPageUnitTestMixinWithCustomViewDirSpec.groovy
  32. +11 −14 grails-test-suite-uber/src/test/groovy/grails/test/mixin/InheritanceWithValidationTests.groovy
  33. +2 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/InterceptorUnitTestMixinSpec.groovy
  34. +7 −7 grails-test-suite-uber/src/test/groovy/grails/test/mixin/MainContextTests.groovy
  35. +0 −30 grails-test-suite-uber/src/test/groovy/grails/test/mixin/MockedBeanSpec.groovy
  36. +7 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/PartialMockWithManyToManySpec.groovy
  37. +7 −9 ...-test-suite-uber/src/test/groovy/grails/test/mixin/ResourceAnnotationRestfulControllerSpec.groovy
  38. +4 −3 grails-test-suite-uber/src/test/groovy/grails/test/mixin/RestfulControllerSpec.groovy
  39. +3 −3 grails-test-suite-uber/src/test/groovy/grails/test/mixin/RestfulControllerSubclassSpec.groovy
  40. +3 −3 grails-test-suite-uber/src/test/groovy/grails/test/mixin/RestfulControllerSuperClassSpec.groovy
  41. +0 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/ServiceTestMixinInheritanceSpec.groovy
  42. +10 −9 grails-test-suite-uber/src/test/groovy/grails/test/mixin/SetupTeardownInvokeTests.groovy
  43. +6 −7 grails-test-suite-uber/src/test/groovy/grails/test/mixin/SpyBeanSpec.groovy
  44. +7 −14 grails-test-suite-uber/src/test/groovy/grails/test/mixin/StaticCallbacksSpec.groovy
  45. +2 −3 grails-test-suite-uber/src/test/groovy/grails/test/mixin/TagLibraryInvokeBodySpec.groovy
  46. +8 −13 ...-test-suite-uber/src/test/groovy/grails/test/mixin/TestForControllerWithoutMockDomainTests.groovy
  47. +0 −44 grails-test-suite-uber/src/test/groovy/grails/test/mixin/TestInstanceCallbacksAnnotationsSpec.groovy
  48. +9 −18 grails-test-suite-uber/src/test/groovy/grails/test/mixin/TestInstanceCallbacksSpec.groovy
  49. +15 −14 grails-test-suite-uber/src/test/groovy/grails/test/mixin/TestMixinSetupTeardownInvokeTests.groovy
  50. +13 −6 grails-test-suite-uber/src/test/groovy/grails/test/mixin/UnitTestDataBindingAssociatonTests.groovy
  51. +29 −19 grails-test-suite-uber/src/test/groovy/grails/test/mixin/UnitTestEmbeddedPropertyQuery.groovy
  52. +182 −126 grails-test-suite-uber/src/test/groovy/grails/test/mixin/UrlMappingsTestMixinTests.groovy
  53. +4 −5 ...er/src/test/groovy/grails/test/mixin/support/GrailsUnitTestMixinGrailsApplicationAwareSpec.groovy
  54. +4 −3 grails-test-suite-uber/src/test/groovy/grails/test/mixin/unique/UniqueConstraintOnHasOneSpec.groovy
  55. +4 −5 grails-test-suite-uber/src/test/groovy/grails/test/runtime/DirtiesRuntimeSpec.groovy
  56. +17 −18 grails-test-suite-uber/src/test/groovy/grails/validation/DomainClassValidationSpec.groovy
  57. +9 −8 grails-test-suite-uber/src/test/groovy/grails/validation/DomainConstraintGettersSpec.groovy
  58. +0 −3 grails-test-suite-uber/src/test/groovy/org/grails/commons/metaclass/LazyMetaPropertyMapSpec.groovy
  59. +6 −5 grails-test-suite-uber/src/test/groovy/org/grails/validation/CascadingErrorCountSpec.groovy
  60. +163 −104 ...uite-uber/src/test/groovy/org/grails/validation/ConstrainedPropertyBuilderForCommandsTests.groovy
  61. +2 −3 grails-test-suite-uber/src/test/groovy/org/grails/validation/TestingValidationSpec.groovy
  62. +14 −20 grails-test-suite-uber/src/test/groovy/org/grails/web/metaclass/ChainMethodTests.groovy
  63. +5 −8 ...uber/src/test/groovy/org/grails/web/metaclass/ChainMethodWithRequestDataValueProcessorSpec.groovy
  64. +14 −11 grails-test-suite-uber/src/test/groovy/org/grails/web/servlet/FlashScopeWithErrorsTests.groovy
  65. +9 −10 ...test-suite-uber/src/test/groovy/org/grails/web/servlet/MultipleRenderCallsContentTypeTests.groovy
  66. +98 −87 grails-test-suite-uber/src/test/groovy/org/grails/web/servlet/RenderMethodTests.groovy
  67. +7 −6 grails-test-suite-uber/src/test/groovy/org/grails/web/servlet/mvc/ControllerInheritanceTests.groovy
  68. +2 −3 grails-test-suite-uber/src/test/groovy/org/grails/web/servlet/mvc/PermanentRedirectSpec.groovy
  69. +4 −7 ...src/test/groovy/org/grails/web/servlet/mvc/RedirectMethodWithRequestDataValueProcessorSpec.groovy
  70. +16 −10 ...ls-test-suite-uber/src/test/groovy/org/grails/web/servlet/mvc/RedirectToDefaultActionTests.groovy
  71. +69 −47 grails-test-suite-uber/src/test/groovy/org/grails/web/servlet/mvc/RenderDynamicMethodTests.groovy
  72. +18 −17 grails-test-suite-uber/src/test/groovy/org/grails/web/servlet/mvc/TagLibDynamicMethodsTests.groovy
  73. +0 −18 grails-test-suite-uber/src/test/groovy/sharedruntimetest/MySharedRuntimeConfigurer.groovy
  74. +0 −17 grails-test-suite-uber/src/test/groovy/sharedruntimetest/SharedRuntimeCheck.groovy
  75. +0 −17 grails-test-suite-uber/src/test/groovy/sharedruntimetest/SharedRuntimeSample2Test.groovy
  76. +0 −17 grails-test-suite-uber/src/test/groovy/sharedruntimetest/SharedRuntimeSampleTest.groovy
  77. +0 −17 ...test-suite-uber/src/test/groovy/sharedruntimetest/subpackage/SharedRuntimeByPkgSample2Test.groovy
  78. +0 −17 ...-test-suite-uber/src/test/groovy/sharedruntimetest/subpackage/SharedRuntimeByPkgSampleTest.groovy
  79. +0 −5 grails-test-suite-uber/src/test/groovy/sharedruntimetest/subpackage/package-info.java
  80. +21 −4 grails-test-suite-web/build.gradle
  81. +3 −6 grails-test-suite-web/src/test/groovy/grails/rest/web/RespondMethodSpec.groovy
  82. +11 −6 grails-test-suite-web/src/test/groovy/grails/test/mixin/TagLibWithServiceMockTests.groovy
  83. +2 −2 grails-test-suite-web/src/test/groovy/grails/test/mixin/TestForControllerWithNamePropertySpec.groovy
  84. +6 −4 grails-test-suite-web/src/test/groovy/grails/test/mixin/UrlMappingsTestForTests.groovy
  85. +2 −3 grails-test-suite-web/src/test/groovy/grails/test/web/ControllerWithGroovyMixinSpec.groovy
  86. +2 −3 grails-test-suite-web/src/test/groovy/grails/test/web/FordedUrlSpec.groovy
  87. +2 −3 grails-test-suite-web/src/test/groovy/grails/test/web/GetHeadersFromResponseSpec.groovy
  88. +3 −5 grails-test-suite-web/src/test/groovy/grails/test/web/RedirectToDomainSpec.groovy
  89. +2 −4 ...-web/src/test/groovy/org/grails/compiler/web/ControllerActionTransformerAllowedMethodsSpec.groovy
  90. +2 −6 grails-test-suite-web/src/test/groovy/org/grails/compiler/web/WithFormatSpec.groovy
  91. +2 −3 ...-suite-web/src/test/groovy/org/grails/compiler/web/converters/ConvertersControllersApiSpec.groovy
  92. +0 −48 grails-test-suite-web/src/test/groovy/org/grails/core/support/MappingContextBuilder.groovy
  93. +2 −3 ...st-suite-web/src/test/groovy/org/grails/plugins/web/rest/render/xml/DefaultXmlRendererSpec.groovy
  94. +7 −11 ...ls-test-suite-web/src/test/groovy/org/grails/web/binding/BindStringArrayToGenericListTests.groovy
  95. +3 −8 grails-test-suite-web/src/test/groovy/org/grails/web/binding/BindToEnumTests.groovy
  96. +3 −8 grails-test-suite-web/src/test/groovy/org/grails/web/binding/BindToObjectWithEmbeddableTests.groovy
  97. +6 −8 ...test-suite-web/src/test/groovy/org/grails/web/binding/BindToPropertyThatIsNotReadableTests.groovy
  98. +20 −15 grails-test-suite-web/src/test/groovy/org/grails/web/binding/BindXmlWithAssociationTests.groovy
  99. +17 −14 grails-test-suite-web/src/test/groovy/org/grails/web/binding/BindingExcludeTests.groovy
  100. +3 −5 grails-test-suite-web/src/test/groovy/org/grails/web/binding/BindingRequestMethodSpec.groovy
  101. +3 −8 grails-test-suite-web/src/test/groovy/org/grails/web/binding/BindingToNullableTests.groovy
  102. +3 −12 grails-test-suite-web/src/test/groovy/org/grails/web/binding/CheckboxBindingTests.groovy
  103. +2 −3 ...test-suite-web/src/test/groovy/org/grails/web/binding/ControllerActionParameterBindingSpec.groovy
  104. +8 −6 ...-test-suite-web/src/test/groovy/org/grails/web/binding/DataBindingLazyMetaPropertyMapTests.groovy
  105. +146 −115 grails-test-suite-web/src/test/groovy/org/grails/web/binding/DataBindingTests.groovy
  106. +3 −9 grails-test-suite-web/src/test/groovy/org/grails/web/binding/EnumBindingTests.groovy
  107. +3 −5 grails-test-suite-web/src/test/groovy/org/grails/web/binding/GrailsParameterMapBindingSpec.groovy
  108. +29 −34 grails-test-suite-web/src/test/groovy/org/grails/web/binding/JSONBindingToNullTests.groovy
  109. +2 −3 ...s-test-suite-web/src/test/groovy/org/grails/web/binding/JSONRequestToResponseRenderingSpec.groovy
  110. +47 −49 grails-test-suite-web/src/test/groovy/org/grails/web/binding/NestedXmlBindingTests.groovy
  111. +5 −6 grails-test-suite-web/src/test/groovy/org/grails/web/binding/hal/json/HalJsonBindingSpec.groovy
  112. +5 −6 grails-test-suite-web/src/test/groovy/org/grails/web/binding/hal/xml/HalXmlBindingSpec.groovy
  113. +2 −4 grails-test-suite-web/src/test/groovy/org/grails/web/binding/json/JsonBindingSpec.groovy
  114. +2 −9 ...-suite-web/src/test/groovy/org/grails/web/binding/json/JsonBindingWithExceptionHandlerSpec.groovy
  115. +5 −8 grails-test-suite-web/src/test/groovy/org/grails/web/binding/xml/XmlBindingSpec.groovy
  116. +2 −5 grails-test-suite-web/src/test/groovy/org/grails/web/codecs/CodecSpec.groovy
  117. +3 −8 ...est-suite-web/src/test/groovy/org/grails/web/commandobjects/CommandObjectInstantiationSpec.groovy
  118. +2 −8 ...-test-suite-web/src/test/groovy/org/grails/web/commandobjects/CommandObjectNullabilitySpec.groovy
  119. +11 −18 grails-test-suite-web/src/test/groovy/org/grails/web/commandobjects/CommandObjectsSpec.groovy
  120. +22 −23 grails-test-suite-web/src/test/groovy/org/grails/web/controllers/ContentNegotiationSpec.groovy
  121. +2 −6 ...e-web/src/test/groovy/org/grails/web/controllers/ControllerExceptionHandlerInheritanceSpec.groovy
  122. +2 −6 ...s-test-suite-web/src/test/groovy/org/grails/web/controllers/ControllerExceptionHandlerSpec.groovy
  123. +2 −3 ...ls-test-suite-web/src/test/groovy/org/grails/web/controllers/ControllerMetaProgrammingSpec.groovy
  124. +11 −10 ...-test-suite-web/src/test/groovy/org/grails/web/converters/ControllerWithXmlConvertersTests.groovy
  125. +39 −33 grails-test-suite-web/src/test/groovy/org/grails/web/converters/ConverterConfigurationTests.groovy
  126. +61 −47 grails-test-suite-web/src/test/groovy/org/grails/web/converters/JSONConverterTests.groovy
  127. +5 −11 grails-test-suite-web/src/test/groovy/org/grails/web/converters/MarshallerRegistrarSpec.groovy
  128. +2 −6 grails-test-suite-web/src/test/groovy/org/grails/web/includes/IncludeHandlingSpec.groovy
  129. +9 −6 grails-test-suite-web/src/test/groovy/org/grails/web/json/DomainClassCollectionRenderingSpec.groovy
  130. +0 −1 grails-test-suite-web/src/test/groovy/org/grails/web/mapping/AdditionalParamsMappingTests.groovy
  131. +62 −48 grails-test-suite-web/src/test/groovy/org/grails/web/mapping/UrlMappingEvaluatorTests.groovy
  132. +0 −3 grails-test-suite-web/src/test/groovy/org/grails/web/mapping/UrlMappingTests.groovy
  133. +13 −11 ...s-test-suite-web/src/test/groovy/org/grails/web/mapping/UrlMappingWithCustomValidatorTests.groovy
  134. +59 −52 grails-test-suite-web/src/test/groovy/org/grails/web/mapping/UrlMappingsHolderTests.groovy
  135. +16 −20 grails-test-suite-web/src/test/groovy/org/grails/web/mapping/ViewUrlMappingTests.groovy
  136. +2 −8 grails-test-suite-web/src/test/groovy/org/grails/web/metaclass/CollectionBindDataMethodSpec.groovy
  137. +93 −56 grails-test-suite-web/src/test/groovy/org/grails/web/mime/ContentFormatControllerTests.groovy
  138. +6 −6 grails-test-suite-web/src/test/groovy/org/grails/web/mime/WithFormatContentTypeSpec.groovy
  139. +0 −3 grails-test-suite-web/src/test/groovy/org/grails/web/servlet/BindDataMethodTests.groovy
  140. +0 −1 grails-test-suite-web/src/test/groovy/org/grails/web/servlet/GrailsFlashScopeSpec.groovy
  141. +0 −1 ...ls-test-suite-web/src/test/groovy/org/grails/web/servlet/mvc/SynchronizerTokensHolderTests.groovy
@@ -5,7 +5,6 @@ dependencies {
project(':grails-web'),
project(':grails-test'),
project(':grails-plugin-domain-class')
// project(':grails-plugin-testing')
compile "org.grails.plugins:converters:$legacyConvertersVersion"
}
@@ -1,8 +1,11 @@
configurations.testCompile {
exclude module: "grails-plugin-testing"
}
dependencies {
testCompile project(':grails-test-suite-base'),
project(':grails-plugin-domain-class'),
project(':grails-plugin-testing'),
project(':grails-plugin-datasource'),
project(':grails-plugin-i18n'),
project(':grails-plugin-url-mappings'),
@@ -47,6 +50,9 @@ dependencies {
testRuntime "org.aspectj:aspectjrt:$aspectjVersion",
"org.aspectj:aspectjweaver:$aspectjVersion"
testCompile ('org.grails:grails-gorm-testing-support:1.0.0.BUILD-SNAPSHOT') {
changing = true
}
}
test {
@@ -1,11 +1,10 @@
package grails.gorm.criteri
import grails.persistence.Entity
import grails.test.mixin.TestFor
import grails.testing.gorm.DomainUnitTest
import spock.lang.Specification
@TestFor(Person)
class WithCriteriaReadOnlySpec extends Specification {
class WithCriteriaReadOnlySpec extends Specification implements DomainUnitTest<Person> {
void 'test that the readOnly criteria method is available in a unit test'() {
given:
@@ -10,7 +10,7 @@ class TransactionalIntegrationTestSpec extends Specification {
void "test that @Integration tests are correctly transformed"() {
when:
Class testClass = new GroovyClassLoader().parseClass('''
import grails.test.mixin.integration.Integration
import grails.testing.mixin.integration.Integration
import grails.transaction.*
import spock.lang.*
@@ -1,38 +1,39 @@
package grails.test.mixin.domain
import grails.persistence.Entity
import grails.test.mixin.TestMixin
import org.junit.Test
import grails.testing.gorm.DataTest
import spock.lang.Specification
@TestMixin(DomainClassUnitTestMixin)
class DomainClassUnitTestMixinTests {
class DomainClassUnitTestMixinTests extends Specification implements DataTest {
@Test
void testBackReferenceAssignment() {
mockDomains Writer, Publication
when:
def publication = new Publication(title: 'Some Paper')
def writer = new Writer(name: 'Some Writer')
writer.addToPublications(publication)
assert publication.ghostWriter == null
assert writer.is(publication.writer)
then:
publication.ghostWriter == null
writer.is(publication.writer)
}
@Test
void testWithTransaction() {
mockDomain Writer
def bodyInvoked = false
when:
def w = new Writer(name: "Stephen King")
w.save(flush:true)
Writer.withTransaction {
bodyInvoked = true
}
assert bodyInvoked
then:
bodyInvoked
}
}
@@ -1,11 +1,10 @@
package grails.test.mixin.domain
import grails.persistence.Entity
import grails.test.mixin.TestFor
import grails.testing.gorm.DomainUnitTest
import spock.lang.Specification
@TestFor(Person)
class SaveDomainSpec extends Specification {
class SaveDomainSpec extends Specification implements DomainUnitTest<Person> {
void 'test dateCreated and lastUpdated populated'() {
given:
@@ -1,20 +1,15 @@
package grails.web.databinding
import grails.persistence.Entity
import grails.test.mixin.Mock
import grails.test.mixin.TestMixin
import grails.test.mixin.domain.DomainClassUnitTestMixin
import grails.testing.gorm.DataTest
import grails.validation.Validateable
import org.grails.core.support.MappingContextBuilder
import spock.lang.Issue
import spock.lang.Specification
@TestMixin(DomainClassUnitTestMixin)
@Mock([Writer, Book])
class GrailsWebDataBinderBindingXmlSpec extends Specification {
class GrailsWebDataBinderBindingXmlSpec extends Specification implements DataTest {
void setupSpec() {
new MappingContextBuilder(grailsApplication).build(Writer, Book)
mockDomains(Writer, Book)
}
@Issue('GRAILS-10868')
@@ -1,9 +1,7 @@
package grails.web.databinding
import grails.databinding.SimpleMapDataBindingSource;
import grails.test.mixin.Mock
import grails.web.databinding.GrailsWebDataBinder
import org.grails.core.support.MappingContextBuilder;
import grails.testing.gorm.DataTest
import spock.lang.Specification
@@ -14,13 +12,12 @@ import spock.lang.Specification
* one test causes problems for other tests.
*
*/
@Mock([Author, Team])
class GrailsWebDataBinderConfigurationSpec extends Specification {
class GrailsWebDataBinderConfigurationSpec extends Specification implements DataTest {
GrailsWebDataBinder binder
void setupSpec() {
new MappingContextBuilder(grailsApplication).build(Author, Team)
mockDomains(Author, Team)
}
void setup() {
@@ -21,27 +21,23 @@ import grails.databinding.SimpleMapDataBindingSource
import grails.databinding.errors.BindingError
import grails.databinding.events.DataBindingListenerAdapter
import grails.persistence.Entity
import grails.test.mixin.Mock
import grails.test.mixin.TestMixin
import grails.test.mixin.domain.DomainClassUnitTestMixin
import grails.testing.gorm.DataTest
import grails.validation.DeferredBindingActions
import grails.validation.Validateable
import org.apache.commons.lang.builder.CompareToBuilder
import org.grails.core.support.MappingContextBuilder
import spock.lang.Ignore
import spock.lang.Issue
import spock.lang.Specification
import spock.lang.Unroll
@TestMixin(DomainClassUnitTestMixin)
@Mock([Foo, AssociationBindingAuthor, AssociationBindingPage, AssociationBindingBook, Author, Child, CollectionContainer, DataBindingBook, Fidget, Parent, Publication, Publisher, Team, Widget])
class GrailsWebDataBinderSpec extends Specification {
class GrailsWebDataBinderSpec extends Specification implements DataTest {
private static Locale defaultLocale = Locale.getDefault()
GrailsWebDataBinder binder
void setupSpec() {
new MappingContextBuilder(grailsApplication).build(Foo, AssociationBindingAuthor, AssociationBindingPage, AssociationBindingBook, Author, Child, CollectionContainer, DataBindingBook, Fidget, Parent, Publication, Publisher, Team, Widget)
mockDomains Foo, AssociationBindingAuthor, AssociationBindingPage, AssociationBindingBook, Author, Child, CollectionContainer, DataBindingBook, Fidget, Parent, Publication, Publisher, Team, Widget
}
void setup() {
@@ -1,9 +1,12 @@
configurations.testCompile {
exclude module: "grails-plugin-testing"
}
dependencies {
compile project(':grails-test-suite-base'),
project(':grails-plugin-interceptors'),
project(':grails-plugin-controllers'),
project(':grails-plugin-testing')
project(':grails-plugin-controllers')
compile "org.grails.plugins:gsp:$gspVersion"
compile "org.apache.tomcat:tomcat-jdbc:$tomcatVersion"
@@ -52,6 +55,13 @@ dependencies {
exclude group: 'java-persistence', module:'persistence-api'
exclude group: 'javassist', module: 'javassist'
}
testCompile ('org.grails:grails-web-testing-support:1.0.0.BUILD-SNAPSHOT') {
changing = true
}
testCompile ('org.grails:grails-gorm-testing-support:1.0.0.BUILD-SNAPSHOT') {
changing = true
}
}
test {
@@ -1,19 +1,25 @@
package grails.test.mixin
import grails.persistence.Entity
import grails.testing.gorm.DataTest
import spock.lang.Specification
import org.junit.Test
class AddToAndServiceInjectionTests extends Specification implements DataTest {
@TestFor(Ship)
@Mock([Ship, Pirate])
class AddToAndServiceInjectionTests {
Class[] getDomainClassesToMock() {
[Ship, Pirate]
}
@Test
void testAddTo() {
given:
def pirate = new Pirate(name: 'Billy')
def ship = new Ship()
when:
ship.addToPirates(pirate)
assert 1 == ship.pirates.size()
then:
1 == ship.pirates.size()
}
}
Oops, something went wrong.

0 comments on commit 8c4f077

Please sign in to comment.