PhoenixIntegration.Assertions.refute_response
You're seeing just the function
refute_response
, go back to PhoenixIntegration.Assertions module for more information.
Refutes a set of conditions for the response fields in a conn. Returns the conn on success so that it can be used in the next integration call.
Parameters
conn
should be a conn returned from a previous request should point to the path being redirected to.conditions
a list of conditions to test against. Conditions can include::status
checks thatconn.status
is not the given numeric value:content_type
the conn's content-type header should not contain the given text. Typical values are"text/html"
or"applicaiton/json"
:body
conn.resp_body should not contain the given text. Does not check the content_type.:html
checks if content_type is html. If it is, it then checks that the given text is not in the body.:json
checks if content_type is json, then checks that the json data does not equal the given map.:path
the route rendered into the conn must not equal the given path (or uri).:uri
same as:path
:redirect
checks ifconn.status
is 302. If it is, then checks that the path in the "location" redirect header is not the given path.:to
same as:redirect
:assigns
checks that conn.assigns does not contain the given values, which could be in the form of%{key: value}
or[{:key, value}]
:value
checks that the value returned by a callback (in the formfn(conn)
) is false or nil
refute_response
is often used in conjuntion with assert_response
to form a complete condition check.
Example
# test a rendered page
follow_path( conn, page_path(conn, :index) )
|> assert_response(
status: 200,
path: page_path(conn, :index)
html: "Good Content"
)
|> refute_response( body: "Invalid Content" )