How to do proper database testing (TDD) on Rails 3 using MongoDB and Mongoid

后端 未结 5 2084
轻奢々
轻奢々 2021-02-04 03:02

How would go about writing proper unit testing (and integration testing for that matter) using MongoDB through Mongoid on Rails ?

I am asking, because to the opposite of

5条回答
  •  情书的邮戳
    2021-02-04 03:50

    This one worked for me.

    In spec_helper.rb, under RSpec.configure do |config| I put:

    config.before :each do
       Mongoid.purge!
    end
    

    Reference.

提交回复
热议问题