Sha256: 9379cfa2a6faadcc7f014acec662fa66b3b34c2942c8ed0edb7f7f5401cb3735

Contents?: true

Size: 750 Bytes

Versions: 10

Compression:

Stored size: 750 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe "Dynamoid::Associations::HasMany" do

  before do
    @magazine = Magazine.create
  end
  
  it 'determines equality from its records' do
    @subscription = @magazine.subscriptions.create
    
    @magazine.subscriptions.should == @subscription
  end

  it 'determines target association correctly' do
    @magazine.subscriptions.send(:target_association).should == :magazine
  end
  
  it 'determines target attribute' do
    @magazine.subscriptions.send(:target_attribute).should == :magazine_ids
  end
  
  it 'associates belongs_to automatically' do
    @subscription = @magazine.subscriptions.create
    
    @subscription.magazine.should == @magazine
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dynamoid-0.2.0 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.1.2 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.1.1 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.1.0 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.0.7 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.0.6 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.0.5 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.0.4 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.0.3 spec/dynamoid/associations/has_many_spec.rb
dynamoid-0.0.2 spec/dynamoid/associations/has_many_spec.rb