【发布时间】:2018-10-11 17:20:52
【问题描述】:
我有路线/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
【问题讨论】: