A reminder why a test should fail first. The following test is green:
def "test absolutely nothing"() { when: def list = [1, 2, 3] then: list.each { it > 0 } }
The following test is also green:
def "test absolutely nothing"() { when: def list = [-1, -2, -3] then: list.each { it > 0 } }
The Spock framework documentation states for then and expect blocks:
Except for calls to void methods and expressions classified as interactions, all top-level expressions in these blocks are implicitly treated as conditions.
To repair the test we have to assert ourselves:
assert it > 0