Closed as not planned
Description
What Ruby, Rails and RSpec versions are you using?
Ruby version: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
Rails version: 7.0.4
RSpec 3.11
- rspec-core 3.11.0
- rspec-expectations 3.11.1
- rspec-mocks 3.11.1
- rspec-rails 6.0.0
- rspec-support 3.11.1
Observed behaviour
For release 5.1.2 we could configure rspec-rails to use rails_helper.rb in the .rspec config file (instead of adding require rails_helper
in each individual spec).
With release 6.0.0 we appear to now load the .rspec
config file when we use the Rails generator for creating a model. This then loads rails_helper.rb
which throws a pending migration error since the generated model's migration has not yet run.
For example:
rails g model user email password_digest
Failure/Error: abort e.to_s.strip
SystemExit:
Migrations are pending. To resolve this issue, run:
bin/rails db:migrate RAILS_ENV=development
You have 1 pending migration:
Expected behaviour
We should do one of the following:
- Revert to the previous existing behavior (not sure if this change was intentional)
- Document that requiring
rails_helper
in the.rspec
configuration is deprecated moving forward - Or improve the check in the template rails_helper.rb when generating a model (unsure of how this would work)
Can you provide an example app?
Metadata
Metadata
Assignees
Labels
No labels