@@ -60,6 +60,10 @@ class TransactionalTransformSpec extends Specification {
6060
6161 }
6262
63+ def cleanup() {
64+
65+ }
66+
6367 void "my test method"() {
6468 expect:
6569 1 == 1
@@ -72,7 +76,45 @@ class TransactionalTransformSpec extends Specification {
7276 TransactionManagerAware . isAssignableFrom(mySpec)
7377 mySpec. getDeclaredMethod(' setup' )
7478 mySpec. getDeclaredMethod(' $tt__setup' , TransactionStatus )
79+ mySpec. getDeclaredMethod(' cleanup' )
80+ mySpec. getDeclaredMethod(' $tt__cleanup' , TransactionStatus )
81+
82+ mySpec. getDeclaredMethod(' $spock_feature_0_0' )
83+ mySpec. getDeclaredMethod(' $tt__$spock_feature_0_0' , TransactionStatus )
84+ }
85+
86+ void " Test @Rollback when applied to Spock specifications and where blocks" () {
87+ when :" A new instance of a class with a @Transactional method is created that subclasses another transactional class"
88+ Class mySpec = new GroovyShell (). evaluate('''
89+ import grails.test.mixin.integration.Integration
90+ import grails.transaction.Rollback
91+ import spock.lang.Specification
92+
93+ @Integration
94+ @Rollback
95+ class DemoSpec extends Specification {
96+
97+ def "test toUpperCase"() {
98+ given:
99+ def result = value.toUpperCase()
100+
101+ expect:
102+ result == expectedResult
103+
104+ where:
105+ value | expectedResult
106+ 'King Crimson' | 'KING CRIMSON\'
107+ 'Riverside' | 'RIVERSIDE\'
108+ }
109+ }
110+ DemoSpec
111+ ''' )
112+
113+ then :" It implements TransactionManagerAware"
114+ TransactionManagerAware . isAssignableFrom(mySpec)
75115 mySpec. getDeclaredMethod(' $spock_feature_0_0' )
116+ mySpec. getDeclaredMethod(' $spock_feature_0_0prov0' )
117+ ! mySpec. getDeclaredMethod(' $tt__$spock_feature_0_0prov0' )
76118 mySpec. getDeclaredMethod(' $tt__$spock_feature_0_0' , TransactionStatus )
77119 }
78120
0 commit comments