bypass v0.8.1 Bypass

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.

This module is the main interface to the library.

Summary

Functions

Starts an Elixir process running a minimal Plug app. The process is a HTTP handler and listens to requests on a TPC port on localhost

Can be called to immediately verify if the declared request expectations have been met

Functions

down(bypass)
expect(bypass, fun)
expect(bypass, methods, paths, fun)
expect_once(bypass, fun)
expect_once(bypass, methods, paths, fun)
open(opts \\ [])

Starts an Elixir process running a minimal Plug app. The process is a HTTP handler and listens to requests on a TPC port on localhost.

Use the other functions in this module to declare which requests are handled and set expectations on the calls.

pass(bypass)
up(bypass)
verify_expectations!(bypass)

Can be called to immediately verify if the declared request expectations have been met.

Returns :ok on success and raises an error on failure.