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
Another way is to use database_cleaner. It supports multiple ORMs, so I think you could do something like this:
# spec/support/database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner[:mongoid].strategy = :truncation
DatabaseCleaner[:mongoid].clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end