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:


  1. RSpec.configure do |config|  
  2.   config.before(:suitedo  
  3.     DatabaseCleaner.orm = :mongoid  
  4.     DatabaseCleaner.strategy = :truncation      
  5.     DatabaseCleaner.clean_with(:truncation)  
  6.   end    
  7.   config.before(:eachdo    
  8.     DatabaseCleaner.start  
  9.   end  
  10.   config.after(:eachdo    
  11.     DatabaseCleaner.clean  
  12.   end  
  13. 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