diff options
author | Nick Thomas <nick@gitlab.com> | 2018-01-22 18:22:03 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-01-24 20:25:55 +0300 |
commit | bbe00038da5b10f8c152332da7d72f38b5552262 (patch) | |
tree | 6259cd07b60ee611ea501858e6461007212c21bc /spec/support/db_cleaner.rb | |
parent | 93ea3234dfaa43204c5f24d4010bbe5070d75c72 (diff) |
Work around a bug in DatabaseCleaner when using the deletion strategy on MySQL
Diffstat (limited to 'spec/support/db_cleaner.rb')
-rw-r--r-- | spec/support/db_cleaner.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb index 7ca88cc61d3..1809ae1d141 100644 --- a/spec/support/db_cleaner.rb +++ b/spec/support/db_cleaner.rb @@ -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 |