I’m trying to run the test samples generated with mix phx.gen.json
. However two of the tests are failing. They are:
-
test does not create todos and renders errors when data is invalid (Todos.Web.TodosControllerTest)
test/todos/web/controllers/todos_controller_test.exs:36 -
test does not update chosen todos and renders errors when data is invalid (Todos.Web.TodosControllerTest)
test/todos/web/controllers/todos_controller_test.exs:53
Both are complaining that (UndefinedFunctionError) function Todos.To.Todos.Web.FallbackController.init/1 is undefined (module Todos.To.Todos.Web.FallbackController is not available)
. But I don’t understand the call to Todos.To.Todos.Web.FallbackController.init/1
when the code should be calling Todos.Web.FallbackController
.
Any help from the community in understanding this will be appreciated.
Update1: When I created a module Todos.To.Todos.Web.FallbackController
, the two tests passed. Does this mean I will have to create such module for every context to get tests that need the action fallback to pass?