У меня есть маршруты /teams
и путь team_path
через mix phx.routes
.Однако я получаю undefined function team_path/3
ниже мой тестовый код:
describe "create team" do
test "renders team when data is valid", %{conn: conn} do
conn = post(conn, team_path(conn, :create, team: @team_attrs))
assert %{"id" => id} = json_response(conn, 201)["data"]
end
test "renders errors when data is invalid", %{conn: conn} do
conn = post(conn, team_path(conn, :create, team: @invalid_attrs))
assert json_response(conn, 400)["errors"] != %{}
end
end
Дополнительная информация:
- Phoenix 1.4-beta
- * Phoenix_swagger установлен
- , это API, так что все в рамках
/api