mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
49 lines
939 B
Ruby
49 lines
939 B
Ruby
require 'mongoid'
|
|
|
|
Mongoid.configure do |config|
|
|
name = 'database_cleaner_test'
|
|
config.master = Mongo::Connection.new.db(name)
|
|
end
|
|
|
|
|
|
#::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
|
|
#::MongoMapper.database = 'database_cleaner_test'
|
|
|
|
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
|