If I start up an instance of my phoenix app and hit it with requests, my plugs will halt appropriately. However, doing the same in a test environment, halt doesn't stop plugs downstream from being invoked which causes my tests to fail. I think the issue might come from the way I'm invoking the router during my test. Here's the helper function I'm using that is heavily borrowed from a similar function in the phoenix framework itself:
def call(router, verb, path, params \\ nil, headers \\ []) do
add_headers(conn(verb, path, params), headers)
|> Plug.Conn.fetch_params
|> Plug.Parsers.call(parsers: [Plug.Parsers.JSON],
pass: ["*/*"],
json_decoder: Poison)
|> router.call(router.init([]))
end
Any ideas as to why calling my router like this causes halting to stop working?
EDIT: So I'm upgrading to Phoenix 0.13.1 in order to use their new endpoint testing module instead of the helper I rolled. I'll report back as to whether this fixes the issue or not.