Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatabaseRewinder.clean_all is not working at rails 7.1.0 #84

Open
starfish719 opened this issue Oct 10, 2023 · 6 comments
Open

DatabaseRewinder.clean_all is not working at rails 7.1.0 #84

starfish719 opened this issue Oct 10, 2023 · 6 comments

Comments

@starfish719
Copy link

starfish719 commented Oct 10, 2023

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 .

@dtcristo
Copy link

Looks like support for Rails 7.1 was added in 52c4d0c and 3870272 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?

@dtcristo
Copy link

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.

@starfish719
Copy link
Author

@dtcristo
Thank you for your comment.
I hope release a new version.

@starfish719
Copy link
Author

@amatsuda
Please release a new version of the gem.
#84 (comment)

@marisveide
Copy link

Please, merge this - very valuable gem, but need it in Rails 7.1.1. 🙏

@shettytejas
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants