Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alChaCC/89fd5c38678dc9d1a736 to your computer and use it in GitHub Desktop.
Save alChaCC/89fd5c38678dc9d1a736 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::Clients.default.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