database_cleaner/examples/lib/mongoid_models.rb

45 lines
810 B
Ruby
Raw Permalink Normal View History

2010-04-13 11:50:25 -04:00
require 'mongoid'
Mongoid.configure do |config|
config.master = Mongo::Connection.new.db('database_cleaner_test')
2010-04-13 11:50:25 -04:00
end
class MongoidWidget
2010-04-13 11:50:25 -04:00
include Mongoid::Document
field :id, :type => Integer
field :name
class << self
#mongoid doesn't seem to provide this...
2010-04-13 11:50:25 -04:00
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
2010-08-23 16:50:32 -04:00
end