Closed rikur closed 5 years ago
Elixir version (elixir -v): Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] [dtrace] Elixir 1.8.1 (compiled with Erlang/OTP 21)
Phoenix version (mix deps):
connection 1.0.4 (Hex package) (mix) locked at 1.0.4 (connection) a1cae722 ok
gettext 0.16.1 (Hex package) (mix) locked at 0.16.1 (gettext) e2130b25 ok
ranch 1.7.1 (Hex package) (rebar3) locked at 1.7.1 (ranch) 6b1fab51 ok
telemetry 0.3.0 (Hex package) (rebar3) locked at 0.3.0 (telemetry) 099a7f3c ok
decimal 1.7.0 (Hex package) (mix) locked at 1.7.0 (decimal) 30d6b52c ok
jason 1.1.2 (Hex package) (mix) locked at 1.1.2 (jason) b03dedea ok
db_connection 2.0.5 (Hex package) (mix) locked at 2.0.5 (db_connection) ddb2ba67 ok
ecto 3.0.7 (Hex package) (mix) locked at 3.0.7 (ecto) 44dda84a ok
phoenix_pubsub 1.1.2 (Hex package) (mix) locked at 1.1.2 (phoenix_pubsub) 496c303b ok
cowlib 2.7.0 (Hex package) (rebar3) locked at 2.7.0 (cowlib) 3ef16e77 ok
cowboy 2.6.1 (Hex package) (rebar3) locked at 2.6.1 (cowboy) f2e06f75 ok
mime 1.3.1 (Hex package) (mix) locked at 1.3.1 (mime) 30ce04ab ok
postgrex 0.14.1 (Hex package) (mix) locked at 0.14.1 (postgrex) 63247d4a ok
ecto_sql 3.0.5 (Hex package) (mix) locked at 3.0.5 (ecto_sql) 7e44172b ok
plug_crypto 1.0.0 (Hex package) (mix) locked at 1.0.0 (plug_crypto) 18e49317 ok
plug 1.7.2 (Hex package) (mix) locked at 1.7.2 (plug) d7b7db7f ok
plug_cowboy 2.0.1 (Hex package) (mix) locked at 2.0.1 (plug_cowboy) d798f8ee ok
phoenix 1.4.1 (Hex package) (mix) locked at 1.4.1 (phoenix) 801f9d63 ok
phoenix_ecto 4.0.0 (Hex package) (mix) locked at 4.0.0 (phoenix_ecto) c43117a1 ok
All tests to pass
$ mix phx.new repro --no-html --binary-id --no-webpack * creating repro/config/config.exs * creating repro/config/dev.exs * creating repro/config/prod.exs * creating repro/config/prod.secret.exs * creating repro/config/test.exs * creating repro/lib/repro/application.ex * creating repro/lib/repro.ex * creating repro/lib/repro_web/channels/user_socket.ex * creating repro/lib/repro_web/views/error_helpers.ex * creating repro/lib/repro_web/views/error_view.ex * creating repro/lib/repro_web/endpoint.ex * creating repro/lib/repro_web/router.ex * creating repro/lib/repro_web.ex * creating repro/mix.exs * creating repro/README.md * creating repro/.formatter.exs * creating repro/.gitignore * creating repro/test/support/channel_case.ex * creating repro/test/support/conn_case.ex * creating repro/test/test_helper.exs * creating repro/test/repro_web/views/error_view_test.exs * creating repro/lib/repro_web/gettext.ex * creating repro/priv/gettext/en/LC_MESSAGES/errors.po * creating repro/priv/gettext/errors.pot * creating repro/lib/repro/repo.ex * creating repro/priv/repo/migrations/.formatter.exs * creating repro/priv/repo/seeds.exs * creating repro/test/support/data_case.ex Fetch and install dependencies? [Yn] y * running mix deps.get * running mix deps.compile We are almost there! The following steps are missing: $ cd repro Then configure your database in config/dev.exs and run: $ mix ecto.create Start your Phoenix app with: $ mix phx.server You can also run your app inside IEx (Interactive Elixir) as: $ iex -S mix phx.server $ cd repro $ mix ecto.create Compiling 10 files (.ex) Generated repro app The database for Repro.Repo has been created $ mix phx.gen.json Accounts User users name:string age:integer * creating lib/repro_web/controllers/user_controller.ex * creating lib/repro_web/views/user_view.ex * creating test/repro_web/controllers/user_controller_test.exs * creating lib/repro_web/views/changeset_view.ex * creating lib/repro_web/controllers/fallback_controller.ex * creating lib/repro/accounts/user.ex * creating priv/repo/migrations/20190308073600_create_users.exs * creating lib/repro/accounts.ex * injecting lib/repro/accounts.ex * creating test/repro/accounts/accounts_test.exs * injecting test/repro/accounts/accounts_test.exs Add the resource to your :api scope in lib/repro_web/router.ex: resources "/users", UserController, except: [:new, :edit] Remember to update your repository by running migrations: $ mix ecto.migrate $ mix ecto.migrate Compiling 6 files (.ex) warning: function ReproWeb.Router.Helpers.user_path/3 is undefined or private lib/repro_web/controllers/user_controller.ex:18 Generated repro app [info] == Running 20190308073600 Repro.Repo.Migrations.CreateUsers.change/0 forward [info] create table users [info] == Migrated 20190308073600 in 0.0s $ mix test ==> connection Compiling 1 file (.ex) Generated connection app ==> gettext Compiling 1 file (.erl) Compiling 20 files (.ex) Generated gettext app ===> Compiling ranch ===> Compiling telemetry ==> decimal Compiling 1 file (.ex) Generated decimal app ==> jason Compiling 8 files (.ex) Generated jason app ==> db_connection Compiling 16 files (.ex) Generated db_connection app ==> ecto Compiling 54 files (.ex) Generated ecto app ==> phoenix_pubsub Compiling 13 files (.ex) Generated phoenix_pubsub app ===> Compiling cowlib ===> Compiling cowboy ==> mime Compiling 2 files (.ex) Generated mime app ==> postgrex Compiling 61 files (.ex) Generated postgrex app ==> ecto_sql Compiling 23 files (.ex) Generated ecto_sql app ==> plug_crypto Compiling 4 files (.ex) Generated plug_crypto app ==> plug Compiling 1 file (.erl) Compiling 38 files (.ex) warning: System.stacktrace/0 outside of rescue/catch clauses is deprecated. If you want to support only Elixir v1.7+, you must access __STACKTRACE__ inside a rescue/catch. If you want to support earlier Elixir versions, move System.stacktrace/0 inside a rescue/catch lib/plug/conn/wrapper_error.ex:23 Generated plug app ==> plug_cowboy Compiling 5 files (.ex) Generated plug_cowboy app ==> phoenix Compiling 67 files (.ex) warning: function Phoenix.HTML.Safe.to_iodata/1 is undefined (module Phoenix.HTML.Safe is not available) lib/phoenix/template/html.ex:14 Generated phoenix app ==> phoenix_ecto Compiling 6 files (.ex) Generated phoenix_ecto app ==> repro Compiling 19 files (.ex) warning: function ReproWeb.Router.Helpers.user_path/3 is undefined or private lib/repro_web/controllers/user_controller.ex:18 Generated repro app .......... 1) test delete user deletes chosen user (ReproWeb.UserControllerTest) test/repro_web/controllers/user_controller_test.exs:78 ** (UndefinedFunctionError) function ReproWeb.Router.Helpers.user_path/3 is undefined or private code: conn = delete(conn, Routes.user_path(conn, :delete, user)) stacktrace: (repro) ReproWeb.Router.Helpers.user_path(%Plug.Conn{adapter: {Plug.Adapters.Test.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: #PID<0.2753.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 80, private: %{phoenix_recycled: true, plug_skip_csrf_protection: true}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/json"}], request_path: "/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, :delete, %Repro.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">, age: 42, id: "520108c6-81f6-4130-8f04-511093cab71c", inserted_at: ~N[2019-03-08 07:36:20], name: "some name", updated_at: ~N[2019-03-08 07:36:20]}) test/repro_web/controllers/user_controller_test.exs:79: (test) 2) test create user renders errors when data is invalid (ReproWeb.UserControllerTest) test/repro_web/controllers/user_controller_test.exs:47 ** (UndefinedFunctionError) function ReproWeb.Router.Helpers.user_path/2 is undefined or private code: conn = post(conn, Routes.user_path(conn, :create), user: @invalid_attrs) stacktrace: (repro) ReproWeb.Router.Helpers.user_path(%Plug.Conn{adapter: {Plug.Adapters.Test.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: #PID<0.2755.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 80, private: %{phoenix_recycled: true, plug_skip_csrf_protection: true}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/json"}], request_path: "/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, :create) test/repro_web/controllers/user_controller_test.exs:48: (test) 3) test update user renders errors when data is invalid (ReproWeb.UserControllerTest) test/repro_web/controllers/user_controller_test.exs:69 ** (UndefinedFunctionError) function ReproWeb.Router.Helpers.user_path/3 is undefined or private code: conn = put(conn, Routes.user_path(conn, :update, user), user: @invalid_attrs) stacktrace: (repro) ReproWeb.Router.Helpers.user_path(%Plug.Conn{adapter: {Plug.Adapters.Test.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: #PID<0.2757.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 80, private: %{phoenix_recycled: true, plug_skip_csrf_protection: true}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/json"}], request_path: "/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, :update, %Repro.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">, age: 42, id: "276c8ec3-39ca-4d71-bb6d-45c2ea053c1e", inserted_at: ~N[2019-03-08 07:36:20], name: "some name", updated_at: ~N[2019-03-08 07:36:20]}) test/repro_web/controllers/user_controller_test.exs:70: (test) 4) test index lists all users (ReproWeb.UserControllerTest) test/repro_web/controllers/user_controller_test.exs:27 ** (UndefinedFunctionError) function ReproWeb.Router.Helpers.user_path/2 is undefined or private code: conn = get(conn, Routes.user_path(conn, :index)) stacktrace: (repro) ReproWeb.Router.Helpers.user_path(%Plug.Conn{adapter: {Plug.Adapters.Test.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: #PID<0.2759.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 80, private: %{phoenix_recycled: true, plug_skip_csrf_protection: true}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/json"}], request_path: "/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, :index) test/repro_web/controllers/user_controller_test.exs:28: (test) 5) test update user renders user when data is valid (ReproWeb.UserControllerTest) test/repro_web/controllers/user_controller_test.exs:56 ** (UndefinedFunctionError) function ReproWeb.Router.Helpers.user_path/3 is undefined or private code: conn = put(conn, Routes.user_path(conn, :update, user), user: @update_attrs) stacktrace: (repro) ReproWeb.Router.Helpers.user_path(%Plug.Conn{adapter: {Plug.Adapters.Test.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: #PID<0.2761.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 80, private: %{phoenix_recycled: true, plug_skip_csrf_protection: true}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/json"}], request_path: "/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, :update, %Repro.Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "users">, age: 42, id: "17a31394-023b-4734-88dd-966ce7eaa393", inserted_at: ~N[2019-03-08 07:36:20], name: "some name", updated_at: ~N[2019-03-08 07:36:20]}) test/repro_web/controllers/user_controller_test.exs:57: (test) 6) test create user renders user when data is valid (ReproWeb.UserControllerTest) test/repro_web/controllers/user_controller_test.exs:34 ** (UndefinedFunctionError) function ReproWeb.Router.Helpers.user_path/2 is undefined or private code: conn = post(conn, Routes.user_path(conn, :create), user: @create_attrs) stacktrace: (repro) ReproWeb.Router.Helpers.user_path(%Plug.Conn{adapter: {Plug.Adapters.Test.Conn, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: #PID<0.2763.0>, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 80, private: %{phoenix_recycled: true, plug_skip_csrf_protection: true}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/json"}], request_path: "/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, :create) test/repro_web/controllers/user_controller_test.exs:35: (test) Finished in 0.1 seconds 16 tests, 6 failures Randomized with seed 448344```
I missed the step:
resources "/users", UserController, except: [:new, :edit]
Environment
Elixir version (elixir -v): Erlang/OTP 21 [erts-10.2.4] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] [dtrace] Elixir 1.8.1 (compiled with Erlang/OTP 21)
Phoenix version (mix deps):
connection 1.0.4 (Hex package) (mix) locked at 1.0.4 (connection) a1cae722 ok
gettext 0.16.1 (Hex package) (mix) locked at 0.16.1 (gettext) e2130b25 ok
ranch 1.7.1 (Hex package) (rebar3) locked at 1.7.1 (ranch) 6b1fab51 ok
telemetry 0.3.0 (Hex package) (rebar3) locked at 0.3.0 (telemetry) 099a7f3c ok
decimal 1.7.0 (Hex package) (mix) locked at 1.7.0 (decimal) 30d6b52c ok
jason 1.1.2 (Hex package) (mix) locked at 1.1.2 (jason) b03dedea ok
db_connection 2.0.5 (Hex package) (mix) locked at 2.0.5 (db_connection) ddb2ba67 ok
ecto 3.0.7 (Hex package) (mix) locked at 3.0.7 (ecto) 44dda84a ok
phoenix_pubsub 1.1.2 (Hex package) (mix) locked at 1.1.2 (phoenix_pubsub) 496c303b ok
cowlib 2.7.0 (Hex package) (rebar3) locked at 2.7.0 (cowlib) 3ef16e77 ok
cowboy 2.6.1 (Hex package) (rebar3) locked at 2.6.1 (cowboy) f2e06f75 ok
mime 1.3.1 (Hex package) (mix) locked at 1.3.1 (mime) 30ce04ab ok
postgrex 0.14.1 (Hex package) (mix) locked at 0.14.1 (postgrex) 63247d4a ok
ecto_sql 3.0.5 (Hex package) (mix) locked at 3.0.5 (ecto_sql) 7e44172b ok
plug_crypto 1.0.0 (Hex package) (mix) locked at 1.0.0 (plug_crypto) 18e49317 ok
plug 1.7.2 (Hex package) (mix) locked at 1.7.2 (plug) d7b7db7f ok
plug_cowboy 2.0.1 (Hex package) (mix) locked at 2.0.1 (plug_cowboy) d798f8ee ok
phoenix 1.4.1 (Hex package) (mix) locked at 1.4.1 (phoenix) 801f9d63 ok
phoenix_ecto 4.0.0 (Hex package) (mix) locked at 4.0.0 (phoenix_ecto) c43117a1 ok
Expected behavior
All tests to pass
Actual behavior