spec/timespan/mongoid/spec_helper.rb in timespan-0.3.2 vs spec/timespan/mongoid/spec_helper.rb in timespan-0.4.0
- old
+ new
@@ -1,12 +1,31 @@
require 'spec_helper'
require 'mongoid'
-require 'bson'
-Mongoid.configure.master = Mongo::Connection.new.db('timespan')
+# puts "version: #{Mongoid::VERSION}"
-Mongoid.database.collections.each do |coll|
- coll.remove
+require 'timespan/mongoid/mongoid_setup'
+
+Mongoid.configure do |config|
+ Mongoid::VersionSetup.configure config
end
+if RUBY_VERSION >= '1.9.2'
+ YAML::ENGINE.yamler = 'syck'
+end
+
+RSpec.configure do |config|
+ # config.mock_with(:mocha)
+
+ config.before(:each) do
+ Mongoid.purge!
+ # Mongoid.database.collections.each do |collection|
+ # unless collection.name =~ /^system\./
+ # collection.remove
+ # end
+ # end
+ end
+end
+
require 'timespan/mongoid'
-require 'timespan/mongoid/account'
+
+require "timespan/mongoid/models/account_#{Mongoid::MAJOR_VERSION}x"
\ No newline at end of file