jesjos / active_record_upsert

Upsert for Rails 5 / Active Record 5
MIT License
207 stars 51 forks source link

Tests: database_cleaner fails #132

Closed olleolleolle closed 1 year ago

olleolleolle commented 1 year ago

on latest Rails, database_cleaner fails - perhaps the whole cleaner ought to be removed?

An error occurred in a `before(:suite)` hook.
Failure/Error: DatabaseCleaner.clean_with(:truncation)

NoMethodError:
  undefined method `table_name' for ActiveRecord::SchemaMigration:Class
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/base.rb:73:in `migration_table_name'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/truncation.rb:271:in `migration_storage_names'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/generic/truncation.rb:14:in `initialize'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/truncation.rb:238:in `initialize'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/base.rb:128:in `new'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/base.rb:128:in `create_strategy'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/base.rb:75:in `clean_with'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/configuration.rb:93:in `block in clean_with'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/configuration.rb:93:in `each'
# ./vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/configuration.rb:93:in `clean_with'
# ./spec/spec_helper.rb:17:in `block (2 levels) in <top (required)>'

Finished in 0.03717 seconds (files took 1.76 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

See this bug: https://github.com/DatabaseCleaner/database_cleaner-active_record/issues/83