Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sure the tests pass in the case closer to described in #8195
  • Loading branch information
rafaelfranca committed Dec 10, 2012
1 parent 09a8b14 commit 660882b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
12 changes: 12 additions & 0 deletions activerecord/test/cases/base_test.rb
Expand Up @@ -23,6 +23,8 @@
require 'models/joke'
require 'models/bulb'
require 'models/bird'
require 'models/car'
require 'models/bulb'
require 'rexml/document'
require 'active_support/core_ext/exception'
require 'bcrypt'
Expand Down Expand Up @@ -2154,6 +2156,16 @@ def test_cache_key_format_for_existing_record_with_updated_at
assert_equal "developers/#{dev.id}-#{dev.updated_at.utc.to_s(:nsec)}", dev.cache_key
end

def test_cache_key_changes_when_child_touched
car = Car.create
Bulb.create(car: car)

key = car.cache_key
car.bulb.touch
car.reload
assert_not_equal key, car.cache_key
end

def test_cache_key_format_for_existing_record_with_nil_updated_at
dev = Developer.first
dev.update_attribute(:updated_at, nil)
Expand Down
18 changes: 0 additions & 18 deletions activerecord/test/cases/cache_key_test.rb

This file was deleted.

2 changes: 1 addition & 1 deletion activerecord/test/models/bulb.rb
@@ -1,6 +1,6 @@
class Bulb < ActiveRecord::Base
default_scope where(:name => 'defaulty')
belongs_to :car
belongs_to :car, :touch => true

attr_protected :car_id, :frickinawesome

Expand Down
1 change: 1 addition & 0 deletions activerecord/test/schema/schema.rb
Expand Up @@ -112,6 +112,7 @@ def create_table(*args, &block)
t.string :name
t.integer :engines_count
t.integer :wheels_count
t.timestamps
end

create_table :categories, :force => true do |t|
Expand Down

0 comments on commit 660882b

Please sign in to comment.