Permalink
Browse files

Adapted database connection for mongoid 3

  • Loading branch information...
jbbarth committed May 30, 2012
1 parent 83cbf18 commit 0aca5b495eca0a6e9bfed749a3a934053afa0233
Showing with 10 additions and 7 deletions.
  1. +6 −0 spec/mongoid.yml
  2. +4 −7 spec/spec_helper.rb
View
@@ -0,0 +1,6 @@
+test:
+ sessions:
+ default:
+ database: ancestry_test
+ hosts:
+ - localhost:27017
View
@@ -6,17 +6,14 @@
require 'mongoid-ancestry'
-Mongoid.configure do |config|
- logger = Logger.new('log/test.log')
- config.master = Mongo::Connection.new('localhost', 27017,
- :logger => logger).db('ancestry_test')
- config.logger = logger
-end
+Mongoid.load!(File.expand_path('../mongoid.yml', __FILE__), 'test')
+Mongoid.logger = Logger.new('log/test.log')
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
config.after :each do
- Mongoid.master.collections.reject { |c| c.name =~ /^system\./ }.each(&:drop)
+ # Drops all collections in the current environment
+ Mongoid::Sessions.default.drop
end
end

0 comments on commit 0aca5b4

Please sign in to comment.