| Author |
Unit testing a closure with Spock
|
Red Maxwell
Greenhorn
Joined: Aug 18, 2012
Posts: 1
|
|
How would one unit test code within a closure using Spock?
// example groovy code
def someObject
def someOtherObject
def x = someCollection.collect{ item ->
someObject.doSomething(item)
}
// example Spock test snippet
then:
1 * someObjectMock.filter() >> foo
2 * someOtherObjectMock.find() >> bar
So here's the question: how to test the someObject.doSomething(item) in the above closure?
|
 |
 |
|
|
subject: Unit testing a closure with Spock
|
|
|