`DatabaseRewinder.clean_all` is not working at rails 7.1.0
spec/support/database_rewrider.rb
# frozen_string_literal: true
require 'rake'
RSpec.configure do |config|
except_tables = %w[
hoge
]
config.before(:suite) do
DatabaseRewinder.strategy = [except: except_tables]
DatabaseRewinder.clean_all
end
config.after do
DatabaseRewinder.clean
end
end
# bundle exec rspec
An error occurred in a `before(:suite)` hook.
Failure/Error: DatabaseRewinder.clean_all
NoMethodError:
undefined method `table_name' for ActiveRecord::SchemaMigration:Class
# ./spec/support/database_rewinder.rb:12:in `block (2 levels) in <main>'
Active Record version is 7.1.0
irb(main):013> ActiveRecord::VERSION::STRING
=> "7.1.0"
ruby and rails version
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
$ bundle exec rails -v
Rails 7.1.0
This code was working at rails 7.0.8 . But not working when update rails 7.1.0 . I hope this code work at rails 7.1.0 .
Looks like support for Rails 7.1 was added in https://github.com/amatsuda/database_rewinder/commit/52c4d0c2317541a75cea08b579349a5a843b8212 and https://github.com/amatsuda/database_rewinder/commit/38702721d7299a23a945417c37d1f202e5e0aea7 but there has been no gem release since.
@amatsuda Are you able to release a new version of the gem with these changes now that Rails 7.1 is out?
I'm still running into issues when using the version from master in a Rails 7.1 application. I still need to investigate further, but it seems DatabaseRewinder.clean (running after each spec) is not working correctly.
@dtcristo Thank you for your comment. I hope release a new version.
@amatsuda Please release a new version of the gem. https://github.com/amatsuda/database_rewinder/issues/84#issuecomment-1765456421
Please, merge this - very valuable gem, but need it in Rails 7.1.1. 🙏
This seems to be working in the latest release (0.9.9). I'm running Rails 7.1.2 and #clean_all is not raising the error.