Add Rails 8 authentication generator#2811
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 |
I want access to: rspec/rspec-rails#2811 Which hasn't yet released
I want access to: rspec/rspec-rails#2811 Which hasn't yet released
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
AuthenticationGeneratorcontainshook_for :test_framework, which callsrspec-rails, but it errors out sincerspec-railsdoes 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-railsso 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.