Bypass provides a quick way to create a custom plug that can be put in place instead of an actual HTTP server to return prebaked responses to client requests.
Sometimes I want to set an expectation that my app will call particular endpoint an exact number of times.. I figured I can achieve that by setting some counter and increment it on each request, then assert on its value.. though, I think it would be nice to be able to set that expectation via Bypass.expect functions.. something similar to Mox.expect/4
Hi there!
Sometimes I want to set an expectation that my app will call particular endpoint an exact number of times.. I figured I can achieve that by setting some counter and increment it on each request, then assert on its value.. though, I think it would be nice to be able to set that expectation via
Bypass.expect
functions.. something similar toMox.expect/4
So in this change I attempted to do exactly that:
and
And if that number of requests is not met - it will raise an error: