I have a controller that returns a json and my controller_test fails everytime I run mix test
in the root of my umbrella project: ** (Protocol.UndefinedError) protocol Jason.Encoder not implemented for schema
It works when I mix test
in app_web
folder though. I already put @derive {Jason.Encoder, only: [....]}
in my schema. My tests in the context also works. Is there any config I missed? Also I don’t use view. I just return straight
conn
|> put_status(200)
|> put_resp_header("content-type", "application/json")
|> json(%{
data: result
})
in the controller.