2010-05-16 15:41:14 -04:00
|
|
|
require 'mongo_mapper'
|
2009-12-23 13:54:17 -05:00
|
|
|
|
|
|
|
::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
|
|
|
|
::MongoMapper.database = 'database_cleaner_test'
|
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
class MongoMapperWidget
|
2009-12-23 13:54:17 -05:00
|
|
|
include MongoMapper::Document
|
|
|
|
key :id, Integer
|
|
|
|
key :name, String
|
2010-02-18 20:37:24 -05:00
|
|
|
|
|
|
|
class << self
|
|
|
|
#mongomapper doesn't seem to provide this...
|
|
|
|
def create!(*args)
|
|
|
|
new(*args).save!
|
|
|
|
end
|
|
|
|
end
|
2009-12-23 13:54:17 -05:00
|
|
|
end
|
2010-05-16 17:26:09 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
class MongoMapperWidgetUsingDatabaseOne
|
|
|
|
include MongoMapper::Document
|
2010-05-30 18:08:22 -04:00
|
|
|
|
2010-05-30 23:12:58 -04:00
|
|
|
connection = Mongo::Connection.new('127.0.0.1')
|
2010-05-30 18:08:22 -04:00
|
|
|
set_database_name = 'database_cleaner_test_one'
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
key :id, Integer
|
|
|
|
key :name, String
|
|
|
|
|
|
|
|
class << self
|
|
|
|
#mongomapper doesn't seem to provide this...
|
|
|
|
def create!(*args)
|
|
|
|
new(*args).save!
|
|
|
|
end
|
2010-05-16 17:26:09 -04:00
|
|
|
end
|
|
|
|
end
|
2010-05-30 14:29:42 -04:00
|
|
|
|
|
|
|
class MongoMapperWidgetUsingDatabaseTwo
|
|
|
|
include MongoMapper::Document
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-30 18:08:22 -04:00
|
|
|
connection = Mongo::Connection.new('127.0.0.1')
|
|
|
|
set_database_name = 'database_cleaner_test_two'
|
2010-05-30 23:12:58 -04:00
|
|
|
|
2010-05-30 14:29:42 -04:00
|
|
|
key :id, Integer
|
|
|
|
key :name, String
|
|
|
|
|
|
|
|
class << self
|
|
|
|
#mongomapper doesn't seem to provide this...
|
|
|
|
def create!(*args)
|
|
|
|
new(*args).save!
|
|
|
|
end
|
|
|
|
end
|
2010-05-30 23:12:58 -04:00
|
|
|
end
|