diff options
Diffstat (limited to 'activerecord/test/cases/timestamp_test.rb')
-rw-r--r-- | activerecord/test/cases/timestamp_test.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb index f765540808..06ab7aa9c7 100644 --- a/activerecord/test/cases/timestamp_test.rb +++ b/activerecord/test/cases/timestamp_test.rb @@ -2,9 +2,10 @@ require 'cases/helper' require 'models/developer' require 'models/owner' require 'models/pet' +require 'models/toy' class TimestampTest < ActiveRecord::TestCase - fixtures :developers, :owners, :pets + fixtures :developers, :owners, :pets, :toys def setup @developer = Developer.first @@ -82,4 +83,20 @@ class TimestampTest < ActiveRecord::TestCase ensure Pet.belongs_to :owner, :touch => true end + + def test_touching_a_record_touches_parent_record_and_grandparent_record + Toy.belongs_to :pet, :touch => true + Pet.belongs_to :owner, :touch => true + + toy = Toy.first + pet = toy.pet + owner = pet.owner + + owner.update_attribute(:updated_at, (time = 3.days.ago)) + toy.touch + + assert_not_equal time, owner.updated_at + ensure + Toy.belongs_to :pet + end end |