Skip to content

Commit

Permalink
Update comment about ActiveRecord::Migration.maintain_test_schema! (#…
Browse files Browse the repository at this point in the history
…2832)

The original comment implies that `maintain_test_schema!` applies pending migrations, but in reality, it purges and recreates the database, then loads the schema.
  • Loading branch information
ohbarye authored Feb 6, 2025
1 parent 5fead52 commit f3b81e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/generators/rspec/install/templates/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
# Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
<% if RSpec::Rails::FeatureCheck.has_active_record_migration? -%>
# Checks for pending migrations and applies them before tests are run.
# Ensures that the test database schema matches the current schema file.
# If there are pending migrations it will invoke `db:test:prepare` to
# recreate the test database by loading the schema.
# If you are not using ActiveRecord, you can remove these lines.
begin
ActiveRecord::Migration.maintain_test_schema!
Expand Down

0 comments on commit f3b81e2

Please sign in to comment.