Last active
May 18, 2017 07:16
-
-
Save nowlinuxing/22ea0ab673a5622eb48d to your computer and use it in GitHub Desktop.
Database rewinder with sharding using ar-octopus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/support/database_rewinder.rb | |
RSpec.configure do |config| | |
config.before(:suite) do | |
DatabaseRewinder['test'] | |
Octopus.config[Rails.env].each do |shard, shard_config| | |
DatabaseRewinder.cleaners << DatabaseRewinder::Cleaner.new( | |
config: shard_config, | |
connection_name: shard, | |
) | |
end | |
DatabaseRewinder.clean_all | |
end | |
config.after(:each) do | |
DatabaseRewinder.clean | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment