Skip to content

Instantly share code, notes, and snippets.

@devton
devton / spec_helper.rb
Created March 21, 2011 02:58
Clear mongodb collection in end of the each
config.after(:each) do
puts "cleaning mongodb...."
Mongoid.database.collections.each do |collection|
unless collection.name =~ /^system\./
collection.remove
end
end
puts "finished cleaning mongodb."
end