-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joke de Buhr <[email protected]>
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package dsld | ||
|
||
import org.codehaus.groovy.ast.expr.* | ||
|
||
assertVersion(groovyEclipse: "2.7.2") // tested against this version | ||
|
||
// DeepMock(Foo) { /* delegates to instance of type Foo /* } | ||
// works for all mock factory methods and all overloads that include a type | ||
contribute( | ||
enclosingClass(subType("spock.lang.Specification")) & | ||
enclosingCallDeclaringType("spock.mock.MockingApi") & | ||
bind(theCalls: enclosingCall(name("DeepMock") | name("GroovyDeepMock") & | ||
enclosingClosure()) { | ||
def args = theCalls.iterator().next().arguments.expressions | ||
def mockType = args.find { it instanceof ClassExpression } | ||
if (mockType) { | ||
delegatesTo(mockType) | ||
} | ||
} |