mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
44 lines
810 B
Ruby
44 lines
810 B
Ruby
require 'mongoid'
|
|
|
|
Mongoid.configure do |config|
|
|
config.master = Mongo::Connection.new.db('database_cleaner_test')
|
|
end
|
|
|
|
class MongoidWidget
|
|
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 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
|
|
end
|