Closed baoist closed 8 years ago
As a workaround I was able to pass in my own conn
to action
, similar to:
subject action :show, %{}, conn |> Phoenix.Controller.accepts(["html", "json"])
Ran into the same issue in a controller spec that asserts using render_template
. The workaround works (thanks @baoist!).
** (UndefinedFunctionError) function Plug.Conn.Unfetched.fetch/2 is undefined (Plug.Conn.Unfetched does not implement the Access behaviour)
(plug) Plug.Conn.Unfetched.fetch(%Plug.Conn.Unfetched{aspect: :params}, "_format")
(elixir) lib/access.ex:148: Access.fetch/2
(elixir) lib/access.ex:179: Access.get/3
(phoenix) lib/phoenix/controller.ex:589: Phoenix.Controller.render/3
(espec) lib/espec/let/let_impl.ex:9: ESpec.Let.Impl.let_eval/2
spec/controllers/admin/user_controller_spec.exs:2: Persumi.Admin.UserControllerSpec.should/1
(espec) lib/espec/example_runner.ex:62: ESpec.ExampleRunner.try_run/3
(espec) lib/espec/example_runner.ex:39: ESpec.ExampleRunner.run_example/2
Hi, guys! Please, migrate to v0.5.0
Switched from rendering via
render conn, "show.html", user: conn.assigns.current_user
torender conn, :show, user: conn.assigns.current_user
and I receive the following error in a controller test.