aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-09-08 15:38:51 -0300
committerEmilio Tagua <miloops@gmail.com>2009-09-08 15:38:51 -0300
commit670281c6b2e9b9e8c51a140f2a5f66b251f1b84b (patch)
treeab141872d72e010c8a0fe371d22a00914c97e1eb /activerecord/test/cases/associations
parent39e4e76d15233bb1cb0b778d920f54efe86bb4f0 (diff)
parent1a0f822037c408a392ffa7b6e1ecbe5951ab48db (diff)
downloadrails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.tar.gz
rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.tar.bz2
rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record/associations.rb
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/habtm_join_table_test.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/habtm_join_table_test.rb b/activerecord/test/cases/associations/habtm_join_table_test.rb
index 745f169ad7..bf3e04c3eb 100644
--- a/activerecord/test/cases/associations/habtm_join_table_test.rb
+++ b/activerecord/test/cases/associations/habtm_join_table_test.rb
@@ -36,9 +36,21 @@ class HabtmJoinTableTest < ActiveRecord::TestCase
uses_transaction :test_should_raise_exception_when_join_table_has_a_primary_key
def test_should_raise_exception_when_join_table_has_a_primary_key
if ActiveRecord::Base.connection.supports_primary_key?
- assert_raise ActiveRecord::HasAndBelongsToManyAssociationWithPrimaryKeyError do
- MyReader.has_and_belongs_to_many :my_books
+ assert_raise ActiveRecord::ConfigurationError do
+ jaime = MyReader.create(:name=>"Jaime")
+ jaime.my_books << MyBook.create(:name=>'Great Expectations')
end
end
end
+
+ uses_transaction :test_should_cache_result_of_primary_key_check
+ def test_should_cache_result_of_primary_key_check
+ if ActiveRecord::Base.connection.supports_primary_key?
+ ActiveRecord::Base.connection.stubs(:primary_key).with('my_books_my_readers').returns(false).once
+ weaz = MyReader.create(:name=>'Weaz')
+
+ weaz.my_books << MyBook.create(:name=>'Great Expectations')
+ weaz.my_books << MyBook.create(:name=>'Greater Expectations')
+ end
+ end
end