Sha256: 495ea74197c3e85de89d413c0a2ebf8c62405bbb45feb3c134fe52011b6b07ef

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 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
    
      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

4 entries across 4 versions & 3 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.4.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter_rails4_fix-0.4.1 spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.4.0 spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.3.0 spec/orm_adapter/adapters/mongo_mapper_spec.rb