Sha256: 2eb6c428eb0e363879f7b2ed2f3b87616758dbeab7467dfb659bc5521a215e7a
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' require 'orm_adapter/example_app_shared' if !defined?(Mongoid) || !(Mongo::Connection.new.db('orm_adapter_spec') rescue nil) puts "** require 'mongoid' start mongod to run the specs in #{__FILE__}" else Mongoid.configure do |config| config.master = Mongo::Connection.new.db('orm_adapter_spec') end module MongoidOrmSpec class User include Mongoid::Document field :name has_many_related :notes, :foreign_key => :owner_id, :class_name => 'MongoidOrmSpec::Note' end class Note include Mongoid::Document field :body, :default => "made by orm" belongs_to_related :owner, :class_name => 'MongoidOrmSpec::User' end # here be the specs! describe Mongoid::Document::OrmAdapter do before do User.delete_all Note.delete_all end describe "the OrmAdapter class" do subject { Mongoid::Document::OrmAdapter } specify "#model_classes should return all document classes" do (subject.model_classes & [User, Note]).to_set.should == [User, Note].to_set end end it_should_behave_like "example app with orm_adapter" do let(:user_class) { User } let(:note_class) { Note } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
orm_adapter-0.0.3 | spec/orm_adapter/adapters/mongoid_spec.rb |
orm_adapter-0.0.2 | spec/orm_adapter/adapters/mongoid_spec.rb |