Forgus / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Interaction check takes precedence over exceptions #374

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Having a test like this

def "Should Create"() {
    when: "We do stuff"
    this.someStuff.do()

    then: "Should not get exception"
    noExceptionThrown()

    and: "Should send mail"
    1 * mailSession.send(*_)
}

If someStuff.do() throws an exception, "Too few invocations for send" is 
reported instead of "Exception thrown".

I'd expect the exception to be reported first since the send is not invoked 
only due to the exception (as the program never gets to send the mail due to 
the exception).

Original issue reported on code.google.com by zia...@gmail.com on 17 Sep 2014 at 9:42