Skip to content

Commit

Permalink
Merge pull request #1 from mtancoigne/fix-rspec-migrations
Browse files Browse the repository at this point in the history
Fix auto-migration in RSpec tests
  • Loading branch information
Floppy authored Nov 26, 2024
2 parents 7d02721 + 348d18d commit 0c7d26a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
Rails.root.join('db', 'migrate'),
Federails::Moderation::Engine.root.join('db', 'migrate'),

Check failure on line 32 in spec/rails_helper.rb

View workflow job for this annotation

GitHub Actions / lint

Style/TrailingCommaInArrayLiteral: Avoid comma after the last item of an array.
]

# Check for migration status
begin
if ActiveRecord::Base.with_connection {|c| c.migration_context.needs_migration? }
# Try to migrate
ActiveRecord::Base.with_connection {|c| c.migration_context.migrate }
migration_context = ActiveRecord::MigrationContext.new ActiveRecord::Migrator.migrations_paths
if migration_context.needs_migration?
migration_context.migrate
end
rescue ActiveRecord::PendingMigrationError => e
abort e.to_s.strip
Expand Down

0 comments on commit 0c7d26a

Please sign in to comment.