Sha256: 3ecc83013395405b047aa94e29fab208759e3a2c5778a58507330ca1491a9027

Contents?: true

Size: 1.32 KB

Versions: 12

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'
require 'orm_adapter/example_app_shared'

if !defined?(DataMapper)
  puts "** require 'dm-core' to run the specs in #{__FILE__}"
else  
  
  DataMapper.setup(:default, 'sqlite::memory:')
  
  module DmOrmSpec
    class User
      include DataMapper::Resource
      property :id,   Serial
      property :name, String
      property :rating, Integer
      has n, :notes, :child_key => [:owner_id]
    end

    class Note
      include DataMapper::Resource
      property :id,   Serial
      property :body, String
      belongs_to :owner, 'User'
    end
    
    require  'dm-migrations'
    DataMapper.finalize
    DataMapper.auto_migrate!
  
    # here be the specs!
    describe DataMapper::Resource::OrmAdapter do
      before do
        User.destroy
        Note.destroy
      end
      
      describe "the OrmAdapter class" do
        subject { DataMapper::Resource::OrmAdapter }

        specify "#model_classes should return all of the non abstract model classes (that are not in except_classes)" do
          subject.model_classes.should == [User, Note]
        end
      end

      it_should_behave_like "example app with orm_adapter" do
        let(:user_class) { User }
        let(:note_class) { Note }
        
        def reload_model(model)
          model.class.get(model.id)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/data_mapper_spec.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/data_mapper_spec.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/data_mapper_spec.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/data_mapper_spec.rb
orm_adapter-0.2.0 spec/orm_adapter/adapters/data_mapper_spec.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/orm_adapter-0.0.7/spec/orm_adapter/adapters/data_mapper_spec.rb
orm_adapter-0.1.0 spec/orm_adapter/adapters/data_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/data_mapper_spec.rb
orm_adapter-0.0.7 spec/orm_adapter/adapters/data_mapper_spec.rb
orm_adapter-0.0.6 spec/orm_adapter/adapters/data_mapper_spec.rb
orm_adapter-0.0.5 spec/orm_adapter/adapters/data_mapper_spec.rb
orm_adapter-0.0.4 spec/orm_adapter/adapters/data_mapper_spec.rb