database_cleaner/examples/lib/mongomapper_models.rb

49 lines
938 B
Ruby
Raw Normal View History

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'
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
class MongoMapperWidgetUsingDatabaseOne
include MongoMapper::Document
database = 'database_cleaner_test_one'
key :id, Integer
key :name, String
class << self
#mongomapper doesn't seem to provide this...
def create!(*args)
new(*args).save!
end
end
end
class MongoMapperWidgetUsingDatabaseTwo
include MongoMapper::Document
database = 'database_cleaner_test_two'
key :id, Integer
key :name, String
class << self
#mongomapper doesn't seem to provide this...
def create!(*args)
new(*args).save!
end
end
end