You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
::Sequel::DATABASES.each do |db|
DatabaseCleaner[:sequel, db: db]
end
::Sequel::DATABASES.count
> 3
DatabaseCleaner.cleaners.count
> 4
DatabaseCleaner.cleaners.values.first.start
RuntimeError: As you have more than one active sequel database you have to specify the one to use manually!
from /home/troex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/database_cleaner-sequel-2.0.2/lib/database_cleaner/sequel/base.rb:8:in `db'
The first cleaner fails because it's not configured, I think it's the issue because of by default it trys to bind for first database, but it does not if there is more than one database in Sequel it should not set at all.
conf.before(:each) do
DatabaseCleaner.cleaners.values.each do |cleaner|
next if cleaner.db == :default
cleaner.start
end
end
conf.append_after(:each) do
DatabaseCleaner.cleaners.values.each do |cleaner|
next if cleaner.db == :default
cleaner.clean
end
end
The text was updated successfully, but these errors were encountered:
I have next code to init cleaners:
The first cleaner fails because it's not configured, I think it's the issue because of by default it trys to bind for first database, but it does not if there is more than one database in Sequel it should not set at all.
https://github.com/DatabaseCleaner/database_cleaner-sequel/blob/main/lib/database_cleaner/sequel.rb#L7
https://github.com/DatabaseCleaner/database_cleaner-sequel/blob/main/lib/database_cleaner/sequel/base.rb#L8
as a workaround have to use next code in rspec:
The text was updated successfully, but these errors were encountered: