aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_one_associations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/associations/has_one_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index dbf6dfe20d..c1dad5e246 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -66,11 +66,6 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
assert_nothing_raised { company.account = company.account }
end
- def test_triple_equality
- assert Account === companies(:first_firm).account
- assert companies(:first_firm).account === Account
- end
-
def test_type_mismatch
assert_raise(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).account = 1 }
assert_raise(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).account = Project.find(1) }
@@ -243,6 +238,14 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
firm.destroy
end
+ def test_finding_with_interpolated_condition
+ firm = Firm.find(:first)
+ superior = firm.clients.create(:name => 'SuperiorCo')
+ superior.rating = 10
+ superior.save
+ assert_equal 10, firm.clients_with_interpolated_conditions.first.rating
+ end
+
def test_assignment_before_child_saved
firm = Firm.find(1)
firm.account = a = Account.new("credit_limit" => 1000)
@@ -312,7 +315,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
def test_creation_failure_without_dependent_option
pirate = pirates(:blackbeard)
- orig_ship = pirate.ship.target
+ orig_ship = pirate.ship
assert_equal ships(:black_pearl), orig_ship
new_ship = pirate.create_ship
@@ -325,7 +328,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
def test_creation_failure_with_dependent_option
pirate = pirates(:blackbeard).becomes(DestructivePirate)
- orig_ship = pirate.dependent_ship.target
+ orig_ship = pirate.dependent_ship
new_ship = pirate.create_dependent_ship
assert new_ship.new_record?