aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-11-15 10:48:32 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-11-15 10:48:32 +0000
commit3441dfdb12d229ef07246a68ce1a775d77adf808 (patch)
treef6d99bca273c3bf09cb9580e8f3d282ba7f11327 /activerecord/test
parent4f4aa4a13b69d85b6a91cf5e751d550f3d0e5a7a (diff)
downloadrails-3441dfdb12d229ef07246a68ce1a775d77adf808.tar.gz
rails-3441dfdb12d229ef07246a68ce1a775d77adf808.tar.bz2
rails-3441dfdb12d229ef07246a68ce1a775d77adf808.zip
Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array. Closes #1345.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/associations_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index fd15098f36..351dc4bcb3 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -79,6 +79,7 @@ class HasOneAssociationsTest < Test::Unit::TestCase
def test_triple_equality
assert Account === companies(:first_firm).account
+ assert companies(:first_firm).account === Account
end
def test_type_mismatch
@@ -280,6 +281,11 @@ class HasManyAssociationsTest < Test::Unit::TestCase
assert_equal 2, Firm.find(:first).clients.length
end
+ def test_triple_equality
+ assert !(Array === Firm.find(:first).clients)
+ assert Firm.find(:first).clients === Array
+ end
+
def test_finding_default_orders
assert_equal "Summit", Firm.find(:first).clients.first.name
end
@@ -747,6 +753,11 @@ class BelongsToAssociationsTest < Test::Unit::TestCase
assert_nothing_raised { account.firm = account.firm }
end
+ def test_triple_equality
+ assert Client.find(3).firm === Firm
+ assert Firm === Client.find(3).firm
+ end
+
def test_type_mismatch
assert_raise(ActiveRecord::AssociationTypeMismatch) { Account.find(1).firm = 1 }
assert_raise(ActiveRecord::AssociationTypeMismatch) { Account.find(1).firm = Project.find(1) }
@@ -1026,6 +1037,11 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
assert active_record.developers.include?(david)
end
+ def test_triple_equality
+ assert !(Array === Developer.find(1).projects)
+ assert Developer.find(1).projects === Array
+ end
+
def test_adding_single
jamis = Developer.find(2)
jamis.projects.reload # causing the collection to load