ShouldI.Matchers.Plug
Convenience macros for generating short test cases of common structure. These matchers work with Plug connections.
Summary
plug_should_respond_with(atom1, context) | |
should_match_body_to(expected) | The connection body ( |
should_respond_with(expected_result) | The connection status (connection.status) should match the expected result |
Macros
The connection body (connection.resp_body
) should match the expected result.
setup context do
some_plug_call_returning_a_context_having_a_connection_key
end
should_match_body_to "this_string_must_be_present_in_body"
The connection status (connection.status) should match the expected result.
Rather than match a specific value, the matchers work against ranges:
success: (200…299) redirect: (300…399) bad_request: 400 unauthorized: 401 missing: 404 error: (500..599)
Examples
setup context do
some_plug_call_returning_a_context_having_a_connection_key
end
should_respond_with :success