Elixir/Plug/Phoenix: Calling halt doesn't stop downstream plugs from getting invoked during test -
if start instance of phoenix app , hit requests, plugs halt appropriately. however, doing same in test environment halt doesn't stop plugs downstream being invoked causes tests fail. think issue might come way i'm invoking router during test. here's helper function i'm using heavily borrowed similar function in phoenix framework itself:
def call(router, verb, path, params \\ nil, headers \\ []) 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 why calling router causes halting stop working?
edit: i'm upgrading phoenix 0.13.1 in order use new endpoint testing module instead of helper rolled. i'll report whether fixes issue or not.
halt
works inside plug pipeline. if manually piping need manually check halt.
honestly, drop current pipeline , invoke actual endpoint tests. endpoint pipeline fast, shouldn't see slow down really.
Comments
Post a Comment