added failing touch propagation test
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
3b44b52fb0
commit
311ea94f73
|
@ -82,4 +82,21 @@ 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
|
||||
|
||||
previously_owner_updated_at = owner.updated_at
|
||||
|
||||
toy.touch
|
||||
|
||||
assert_not_equal previously_owner_updated_at, owner.updated_at
|
||||
ensure
|
||||
Toy.belongs_to :pet
|
||||
end
|
||||
end
|
||||
|
|
|
@ -398,6 +398,7 @@ ActiveRecord::Schema.define do
|
|||
create_table :pets, :primary_key => :pet_id ,:force => true do |t|
|
||||
t.string :name
|
||||
t.integer :owner_id, :integer
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :pirates, :force => true do |t|
|
||||
|
@ -530,6 +531,7 @@ ActiveRecord::Schema.define do
|
|||
create_table :toys, :primary_key => :toy_id ,:force => true do |t|
|
||||
t.string :name
|
||||
t.integer :pet_id, :integer
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :traffic_lights, :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue