Skip to content

Instantly share code, notes, and snippets.

@stuartmackey
Created March 1, 2012 08:55
Show Gist options
  • Save stuartmackey/1948435 to your computer and use it in GitHub Desktop.
Save stuartmackey/1948435 to your computer and use it in GitHub Desktop.
Teardown script to remove MongoDB collections after each test run in Rails
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