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

后端 未结 5 2086
轻奢々
轻奢々 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:40

    There's no way to make MongoDB non-persistent. You simply have to delete data before or after each test. There's some documentation on that here:

    http://www.mongodb.org/display/DOCS/Rails+-+Getting+Started#Rails-GettingStarted-Testing

提交回复
热议问题