Title: Programming Phoenix LiveView: P97 test authentication generation issue
I’m not familiar with the syntax (auth *) → mix test
If I run (auth *) → mix test
I get zsh: parse error near ‘-’
If I run mix test
22 tests fail and so far it seems to be because a user is not found.
One other note. I recently switched to asdf but so far everything has been working OK.
#errata/book-programming-phoenix-liveview
Resolved.
For some reason after running “mix phx.gen.auth Accounts User users”, the line “plug(:fetch_current_user)” wasn’t added in the router.ex. I started over and tried again with the same result. On a separate project, it worked fine.
I still don’t understand the command in the book for running tests:
(auth *) → mix test
If I just run mix test, now all tests pass.
Great to hear your tests are passing! the (auth *)
is a designation of the branch that we were on when we copy/pasted that code from our terminal into the prose for this chapter. I’ll update that it should simply read mix test
as you’ve found works.
I had the same issue. IMO the book should call attention to the output of mix phx.gen.auth
, which instructs to add plug(:fetch_current_user)
to the router’s browser
pipeline.
Thanks for the book at the many updates since it was published.
Running Elixir 1.17.2/Phoenix 1.7.14