Skip to content

Instantly share code, notes, and snippets.

@zbelzer
Created March 22, 2010 14:25
Show Gist options
  • Save zbelzer/340120 to your computer and use it in GitHub Desktop.
Save zbelzer/340120 to your computer and use it in GitHub Desktop.
class ActiveSupport::TestCase
# Drop all columns after each test case.
def teardown
MongoMapper.database.collections.each do |coll|
coll.remove unless coll.name =~ /^system\./
end
end
# Make sure that each test case has a teardown
# method to clear the db after each test.
def inherited(base)
base.define_method teardown do
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment