domingo, 9 de janeiro de 2011

RSpec+Mongo+DatabaseCleaner

0

Em portugues

Some times ago, I wrote about RSpec and MongoDB I was used the DatabaseCleaner 0.5.2, the version 0.6.0 was released some times ago, and I not tested it before, the changes are simple, the main change is the orm options need to be before the stategy option, see below the spec_helper.rb:


RSpec.configure do |config|
  config.before(:suite) do
    DatabaseCleaner.orm = :mongoid
    DatabaseCleaner.strategy = :truncation    
    DatabaseCleaner.clean_with(:truncation)
  end  
  config.before(:each) do  
    DatabaseCleaner.start
  end
  config.after(:each) do  
    DatabaseCleaner.clean
  end
end

Also changed the before option, now it's initialize the Cleaner, and the after option, clean the database

0 comentários:

 
Design by ThemeShift | Bloggerized by Lasantha - Free Blogger Templates | Best Web Hosting