Maru v0.13.2 Maru.Test View Source

Unittest wrapper for designated router.

Link to this section Summary

Functions

Create a test connection

Get response from conn as json

Put body or params into conn

Get response from conn as text

Link to this section Functions

Create a test connection.

get("/") is used to test a simple request. build_conn/0 is useful when test a complex request with headers or params.

Examples

get("/", "v1")
build_conn() |> put_body_or_params("body params") |> post("/path", "v2")
build_conn() |> put_req_header("Authorisation", "something") |> get("/path")

Get response from conn as json.

Link to this function put_body_or_params(conn, body_or_params) View Source

Put body or params into conn.

Get response from conn as text.