Global setup/teardown for Rails & Mongoid 3.0
Put this in your test/test_helper.rb to truncate all collection after each test using mongoid.
class ActiveSupport::TestCase
# Drop all columns after each test case.
teardown :clean_mongodb
def clean_mongodb
Mongoid.purge!
end
end
Written by Carlos Hernández
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#