diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-01-15 21:34:19 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-01-16 09:05:55 -0200 |
commit | 38fcee3871b2d39cd8ad713b2e9130e52ebd8553 (patch) | |
tree | 98d304b14cda1174d53de83208e392de8f1b0a5d /activerecord/test/cases | |
parent | fbab7b2acc1db4b8f1a9212350721b7716e74ac8 (diff) | |
download | rails-38fcee3871b2d39cd8ad713b2e9130e52ebd8553.tar.gz rails-38fcee3871b2d39cd8ad713b2e9130e52ebd8553.tar.bz2 rails-38fcee3871b2d39cd8ad713b2e9130e52ebd8553.zip |
Fix test for cache_key + touched
Ensure the child can actually be touched. The `Bulb` model has no
timestamp column, thus trying to touch it would return `nil`.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/integration_test.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb index 2e71b1a40d..dfb8a608cb 100644 --- a/activerecord/test/cases/integration_test.rb +++ b/activerecord/test/cases/integration_test.rb @@ -3,12 +3,11 @@ require 'cases/helper' require 'models/company' require 'models/developer' -require 'models/car' -require 'models/bulb' require 'models/owner' +require 'models/pet' class IntegrationTest < ActiveRecord::TestCase - fixtures :companies, :developers, :owners + fixtures :companies, :developers, :owners, :pets def test_to_param_should_return_string assert_kind_of String, Client.first.to_param @@ -91,13 +90,14 @@ class IntegrationTest < ActiveRecord::TestCase end def test_cache_key_changes_when_child_touched - car = Car.create - Bulb.create(car: car) + owner = owners(:blackbeard) + pet = pets(:parrot) + + owner.update_column :updated_at, Time.current + key = owner.cache_key - key = car.cache_key - car.bulb.touch - car.reload - assert_not_equal key, car.cache_key + assert pet.touch + assert_not_equal key, owner.reload.cache_key end def test_cache_key_format_for_existing_record_with_nil_updated_timestamps |