Phoenix.ConnTest.assert_error_sent/2

Parsed documentation:
View on GitHub
Asserts an error was wrapped and sent with the given status.

Useful for testing actions that you expect raise an error and have
the response wrapped in an HTTP status, with content usually rendered
by your MyApp.ErrorView.

The function accepts a status either as an integer HTTP status or
atom, such as `404` or `:not_found`. If an error is raised, a
3-tuple of the wrapped response is returned matching the
status, headers, and body of the response:

    {404, [{"content-type", "text/html"} | _], "Page not found"}

## Examples

    assert_error_sent :not_found, fn ->
      get(build_conn(), "/users/not-found")
    end

    response = assert_error_sent 404, fn ->
      get(build_conn(), "/users/not-found")
    end
    assert {404, [_h | _t], "Page not found"} = response
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.