Configuring RSpec with new Rails/MongoID application -


i'm starting new app , notice missing documentation last time built mongoid app scratch. namely used suggest on page no longer exists (http://mongoid.org/docs/integration/) include code drop mongoid's collections (after tests).

it's not mentioned on site anymore...is (**** below) no longer considered necessary or practice?!?

#spec/spec_helper.rb: ... rspec.configure |config|    config.mock_with :rspec    # remove line if you're not using activerecord or activerecord fixtures   #config.fixture_path = "#{::rails.root}/spec/fixtures"    # if you're not using activerecord, or you'd prefer not run each of   # examples within transaction, remove following line or assign false   # instead of true.   #config.use_transactional_fixtures = true    # below <http://mongoid.org/docs/integration/>  ****   config.after :suite     mongoid.master.collections.select |collection|       collection.name !~ /system/     end.each(&:drop)   end end 

modify file spec/spec_helper.rb add this:

 rspec.configure |config|   # other things    # clean database   require 'database_cleaner'   config.before(:suite)     databasecleaner.strategy = :truncation     databasecleaner.orm = "mongoid"   end    config.before(:each)     databasecleaner.clean   end end 

Comments