Sha256: 180044d60da8cd84bb4fc1f21dede4a87b75c13be4ed665e5326cdd2c426de9c

Contents?: true

Size: 1.07 KB

Versions: 8

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 unless coll.name =~ /system/
        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

8 entries across 8 versions & 6 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/orm_adapter-0.5.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/orm_adapter-0.5.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/orm_adapter-0.5.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/orm_adapter-0.5.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/orm_adapter-0.5.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/orm_adapter-0.5.0/spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.5.0 spec/orm_adapter/adapters/mongo_mapper_spec.rb
orm_adapter-0.4.1 spec/orm_adapter/adapters/mongo_mapper_spec.rb