Created
March 1, 2012 08:55
-
-
Save stuartmackey/1948435 to your computer and use it in GitHub Desktop.
Teardown script to remove MongoDB collections after each test run in Rails
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
teardown :clean_mongodb | |
def clean_mongodb | |
Mongoid.database.collections.each do |collection| | |
unless collection.name =~ /^system\./ | |
collection.remove | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment