Sha256: f76e25327d8b0e639ea59f19a7a26bffc9214bb9c4589b04a607f2af26ede27b
Contents?: true
Size: 1.22 KB
Versions: 16
Compression:
Stored size: 1.22 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe "Dynamoid::Associations::HasMany" do before do @magazine = Magazine.create @user = User.create @camel_case = CamelCase.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 @user.books.send(:target_association).should == :owner @camel_case.users.send(:target_association).should == :camel_case end it 'determins target class correctly' do @magazine.subscriptions.send(:target_class).should == Subscription @user.books.send(:target_class).should == Magazine end it 'determines target attribute' do @magazine.subscriptions.send(:target_attribute).should == :magazine_ids @user.books.send(:target_attribute).should == :owner_ids end it 'associates belongs_to automatically' do @subscription = @magazine.subscriptions.create @subscription.magazine.should == @magazine @magazine = @user.books.create @magazine.owner.should == @user end end
Version data entries
16 entries across 16 versions & 3 rubygems