2010-04-13 11:50:25 -04:00
|
|
|
require 'mongoid'
|
|
|
|
|
|
|
|
Mongoid.configure do |config|
|
2014-12-10 09:11:05 -05:00
|
|
|
config.master = Mongo::Connection.new.db('database_cleaner_test')
|
2010-04-13 11:50:25 -04:00
|
|
|
end
|
|
|
|
|
2010-06-15 10:24:50 -04:00
|
|
|
class MongoidWidget
|
2010-04-13 11:50:25 -04:00
|
|
|
include Mongoid::Document
|
|
|
|
field :id, :type => Integer
|
|
|
|
field :name
|
|
|
|
|
|
|
|
class << self
|
2010-06-15 10:24:50 -04:00
|
|
|
#mongoid doesn't seem to provide this...
|
2010-04-13 11:50:25 -04:00
|
|
|
def create!(*args)
|
|
|
|
new(*args).save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-06-15 10:24:50 -04:00
|
|
|
|
|
|
|
class MongoidWidgetUsingDatabaseOne
|
|
|
|
include Mongoid::Document
|
|
|
|
field :id, :type => Integer
|
|
|
|
field :name
|
|
|
|
|
|
|
|
class << self
|
|
|
|
#mongoid doesn't seem to provide this...
|
|
|
|
def create!(*args)
|
|
|
|
new(*args).save!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class MongoidWidgetUsingDatabaseTwo
|
|
|
|
include Mongoid::Document
|
|
|
|
field :id, :type => Integer
|
|
|
|
field :name
|
|
|
|
|
|
|
|
class << self
|
|
|
|
#mongoid doesn't seem to provide this...
|
|
|
|
def create!(*args)
|
|
|
|
new(*args).save!
|
|
|
|
end
|
|
|
|
end
|
2010-08-23 16:50:32 -04:00
|
|
|
end
|