-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add Rails 8 authentication generator #2811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ca513ce
to
80fb4ba
Compare
80fb4ba
to
c3f18dd
Compare
a2471be
to
1d18e60
Compare
I think this is a good start, I'm sort of wondering if it makes sense to add some scaffold specs showing that login works but I think I'm right in thinking the generator as is doesn't generate any tests at all? |
Correct, the Rails 8 generator doesn't generate any controller or integration or system tests or anything, I guess the Rails team decided to leave these as an exercise for the user. The only test it generates is an empty I think that if Rails generates more tests in a future version, such as login tests, then the same could be done in |
1d18e60
to
032b71d
Compare
Thanks! |
After a long delay (sorry) this has been released in 8.0.0 |
Fixes #2810.
Problem
When running Rails 8's
bin/rails generate authentication
, generation ends with with the following error:error rspec [not found]
.This is because the Rails
AuthenticationGenerator
containshook_for :test_framework
, which callsrspec-rails
, but it errors out sincerspec-rails
does not have an authentication generator.Solution
Add authentication generator that creates a user test and possibly a fixture, similarly to Rails'
TestUnit::Generators::AuthenticationGenerator
. The fixture is basically the same as the Rails one except that it has a comment similar torspec-rails
' model fixture.An alternative solution could be to somehow disable the authentication generator for
rspec-rails
so nothing is generated while not having any errors. This might be a viable option if Rails adds more generators in the future and playing catch-up is undesired.