0yfpnq
Last Updated: February 25, 2016
·
727
· polimorfico

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