bypass icon indicating copy to clipboard operation
bypass copied to clipboard

Pipe expectations

Open thiamsantos opened this issue 5 years ago • 0 comments

Motivation

Would be nice to be able to pipe expectation calls, passing the bypass instance to next expectation.

bypass
|> Bypass.expect("POST", "/auth", fn conn ->
  # response ...
end)
|> Bypass.expect("POST", "/resource", fn conn ->
  # assert authenticated
  # response
end)

Similar to what mox does:

MyMock
|> expect(:add, fn x, y -> x + y end)
|> expect(:add, fn x, y -> x * y end)

Proposed solution

Return the bypass instance back in all expectation functions.

thiamsantos avatar Aug 22 '20 16:08 thiamsantos