Sha256: e9c9efcf162c876e1fa594142c3be7051d729fd818ac29af5518b3189e91e9a1

Contents?: true

Size: 1.34 KB

Versions: 11

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'
require 'orm_adapter/example_app_shared'

if !defined?(MongoMapper) || !(Mongo::Connection.new.db('orm_adapter_spec') rescue nil)
  puts "** require 'mongo_mapper' and start mongod to run the specs in #{__FILE__}"
else  
  
  MongoMapper.connection = Mongo::Connection.new
  MongoMapper.database = "orm_adapter_spec"
  
  
  module MongoMapperOrmSpec
    class User
      include MongoMapper::Document
      key :name
      key :rating
      many :notes, :foreign_key => :owner_id, :class_name => 'MongoMapperOrmSpec::Note'
    end

    class Note
      include MongoMapper::Document
      key :body, :default => "made by orm"
      belongs_to :owner, :class_name => 'MongoMapperOrmSpec::User'
    end
    
    # here be the specs!
    describe MongoMapper::Document::OrmAdapter do
      
      before do
        MongoMapper.database.collections.each do | coll |
          coll.remove
        end
      end
      
      describe "the OrmAdapter class" do
        subject { MongoMapper::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

11 entries across 11 versions & 3 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/mongo_mapper_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/mongo_mapper_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/mongo_mapper_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.2.0 spec/orm_adapter/adapters/mongo_mapper_spec.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.1.0 spec/orm_adapter/adapters/mongo_mapper_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.0.7 spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.0.6 spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.0.5 spec/orm_adapter/adapters/mongo_mapper_spec.rb