From 9a9949d1839da1afd14e26312a2641c0cd805148 Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Tue, 6 Jul 2010 18:13:43 -0400 Subject: [PATCH] created some tests to test validity of bug #3580 --- .../associations/has_many_associations_test.rb | 4 ++++ activerecord/test/models/company.rb | 1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 49eca30..41005b6 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1197,6 +1197,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal 'Welcome to the weblog', Comment.all.map { |comment| comment.post }.sort_by(&:id).first.title end + def test_has_many_associations_thingy + firm = Firm.first + assert_nothing_raised { firm.exclusively_dependent_microsoft_clients } + end def test_instance_eval_in_association_proxy assert_equal 'Welcome to the weblog', Comment.all.map { |comment| comment.post }.sort_by(&:id).first.instance_eval{title} end diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index de1a1cc..c6c7a0b 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -45,6 +45,7 @@ class Firm < Company has_many :unvalidated_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :validate => false has_many :dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :destroy has_many :exclusively_dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all + has_many :exclusively_dependent_microsoft_clients, :foreign_key => "client_of", :class_name => "Client", :conditions => {:name => 'Microsoft'}, :dependent => :delete_all has_many :limited_clients, :class_name => "Client", :order => "id", :limit => 1 has_many :clients_like_ms, :conditions => "name = 'Microsoft'", :class_name => "Client", :order => "id" has_many :clients_with_interpolated_conditions, :class_name => "Client", :conditions => 'rating > #{rating}' -- 1.7.0.4