I have created a new controller action and I would like to test it from the console to make sure it works.
How can I execute the action after running iex -S mix phx.server
in the terminal? It seems to me that in order to do this, I need to create a conn
struct as well as a user
struct (since I am using Guardian).
My controller code looks like this:
defmodule HelloWeb.AssetController do
use HelloWeb, :controller
use Guardian.Phoenix.Controller
action_fallback HelloWeb.FallbackController
def new_action(conn, %{"id" => id}, user, _claims) do
# Stuff I want to test
end
# Other actions omitted
end
How can I test new_action
from IEx?