rspec/rspec-rails

Lacks a corresponding generator to the Rails 8 authentication system generator

Closed this issue · 2 comments

What Ruby, Rails and RSpec versions are you using?

Ruby version: 3.3.6
Rails version: 8.0.0
RSpec version: rspec-rails 7.0.1

Observed behaviour

rspec-rails lacks a corresponding generator to the authentication system generator added by Rails 8.0.0 which can be run by bin/rails generate authentication, and produce an error.

Expected behaviour

rspec-rails generates boilerplate specs corresponding to the authentication system generator when you run bin/rails generate authentication.

Can you provide an example reproduction?

  1. Initialize a fresh rails app with rails new --skip-test sample-app
  2. Add rspec-rails to the Gemfile and run bundle install
  3. Run bin/rails generate authentication
  4. Command ends with error rspec [not found] like below:
bin/rails generate authentication
      invoke  erb
      create    app/views/passwords/new.html.erb
      create    app/views/passwords/edit.html.erb
      create    app/views/sessions/new.html.erb
      create  app/models/session.rb
      create  app/models/user.rb
      create  app/models/current.rb
      create  app/controllers/sessions_controller.rb
      create  app/controllers/concerns/authentication.rb
      create  app/controllers/passwords_controller.rb
      create  app/channels/application_cable/connection.rb
      create  app/mailers/passwords_mailer.rb
      create  app/views/passwords_mailer/reset.html.erb
      create  app/views/passwords_mailer/reset.text.erb
      create  test/mailers/previews/passwords_mailer_preview.rb
      insert  app/controllers/application_controller.rb
       route  resources :passwords, param: :token
       route  resource :session
        gsub  Gemfile
      bundle  install --quiet
    generate  migration CreateUsers email_address:string!:uniq password_digest:string! --force
       rails  generate migration CreateUsers email_address:string!:uniq password_digest:string! --force
      invoke  active_record
      create    db/migrate/20241108074415_create_users.rb
    generate  migration CreateSessions user:references ip_address:string user_agent:string --force
       rails  generate migration CreateSessions user:references ip_address:string user_agent:string --force
      invoke  active_record
      create    db/migrate/20241108074416_create_sessions.rb
       error  rspec [not found]

PRs welcome 😂

I took a stab at it in #2811.