-
-
Notifications
You must be signed in to change notification settings - Fork 381
Closed
Labels
Description
Description
I am not able to use bin/rails generate authentication
after installing factory_bot_rails
with RSpec.
I am opening this ticket here because when I removed it from the Gemfile the generator worked with test-unit
. I hope I am not in the wrong place. It might be factory_bot or maybe even rspec-rails.
When I comment out factory_bot_rails
from the Gemfile it also works, though it generate fixtures:
...
rails generate migration CreateSessions user:references ip_address:string user_agent:string --force
invoke rspec
create spec/models/user_spec.rb
create spec/fixtures/users.yml
It works fine with other generators like model and scaffold, except when I use authentication generator.
Thanks!
Reproduction Steps
- Create a new project using Rails 8.0.2.
- Add factory_bot (or allow it to be installed by the factory_bot_rails in a future step).
- Install faker. - Probably unrelated, but these were my steps.
- Install rspec-rails and run
bin/rails generate rspec:install
. - Add or remove
config.include FactoryBot::Syntax::Methods
from rails_helper.rb or spec_helper.rb. I tried a few combinations. - Run
bin/rails generate authentication
(with or without--pretend
).
Expected behavior
Authentication to be generated.
Actual behavior
I get this error:
...
rails generate migration CreateSessions user:references ip_address:string user_agent:string --force
invoke rspec
create spec/models/user_spec.rb
error factory_bot [not found]
System configuration
factory_bot_rails version: 6.4.4
factory_bot version: 6.5.1
rails version: 8.0.2
ruby version: 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [aarch64-linux]
stulzer, HeitorRangel, ardavis, brentdodell, ShaunDecker and 2 more