Work around a bug in DatabaseCleaner when using the deletion strategy on MySQL

This commit is contained in:
Nick Thomas 2018-01-22 15:22:03 +00:00
parent 93ea3234df
commit bbe00038da
No known key found for this signature in database
GPG Key ID: 2A313A47AFADACE9
1 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,18 @@
require 'database_cleaner/active_record/deletion'
module FakeInformationSchema
# Work around a bug in DatabaseCleaner when using the deletion strategy:
# https://github.com/DatabaseCleaner/database_cleaner/issues/347
#
# On MySQL, if the information schema is said to exist, we use an inaccurate
# row count leading to some tables not being cleaned when they should
def information_schema_exists?(_connection)
false
end
end
DatabaseCleaner::ActiveRecord::Deletion.prepend(FakeInformationSchema)
RSpec.configure do |config|
# Ensure all sequences are reset at the start of the suite run
config.before(:suite) do