Sha256: dd2c21f7f8592fa7e8621828e02d45e55b2080e5109fc368b8a80e9cde35e2e8
Contents?: true
Size: 623 Bytes
Versions: 23
Compression:
Stored size: 623 Bytes
Contents
require File.expand_path("../../spec_helper", __FILE__) describe "Has many associations" do before do @user = User.create :name => "Fred" @addresses = (0..2).map { Address.create :user_id => @user.id } end it "returns the objects whose foreign keys match the object's id" do found = @user.addresses.all.sort { |a, b| a.id <=> b.id } found.should == @addresses.sort { |a, b| a.id <=> b.id } end it "accepts class_name and foreign_key overrides" do found = @user.addresses_override.all.sort { |a, b| a.id <=> b.id } found.should == @addresses.sort { |a, b| a.id <=> b.id } end end
Version data entries
23 entries across 23 versions & 7 rubygems