xetorthio/shmock — pull request #7 by kylezeeuwen (2014-07-27 22:30:31+00:00)
Title: Differentiate by query param

I have added a solution for Issue #2.
Currently we cannot register two persistent Assertions that vary only by the request query parameters.
If we did so the first Assertions would always be called, and if it did not match the query params then the Assertion would throw an exception, which does not give the second Assertion a chance to match.

In the new branch, the assertions will pass via next() to the next assertion, allowing the correct response to be selected.

I wanted to be backwards compatible, so I did not change the existing .query() method. As a result the Assertion API can be confusing (i.e. what is diff between .query() and ifQuery()). An alternative is reuse .query but add an additional API call that will change the error handling mode from 'raise exception' to 'pass' .