Sha256: f9ed2c669b872e2ce04fa6cb9d7d4e9dadf1fab47625da0fabe0ca13e4cd5bf5

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

$LOAD_PATH << File.dirname(__FILE__)
require 'spec_helper'

class Order
  include DataMapper::Resource

  property :id, Serial

  repository(:ldap) do
    belongs_to :user
  end
end

Order.auto_migrate!(:default)

describe DataMapper.repository(:ldap).adapter do

  describe 'belongs_to association' do

    before do
      DataMapper.repository(:ldap) do
        @user = User.new(:login => "beige", :name => 'Beige')
        @user.password = "asd123"
        @user.save
      end

      @order = Order.create
    end

    after do
      DataMapper.repository(:ldap) do
        @user.destroy
      end
      @order.destroy
    end

    it 'should create and load the association' do
      @order.user = @user
      @order.save
      Order.get!(@order.id).user.should == @user
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-ldap-adapter-0.3.5 spec/multi_repository_spec.rb
dm-ldap-adapter-0.3.4 spec/multi_repository_spec.rb