diff options
author | jacobstr <jacobstr@gmail.com> | 2012-11-26 16:50:04 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-10 15:33:01 -0300 |
commit | cc9958026409d7a4b76af555c0240db4428a071b (patch) | |
tree | 7852e331c5efcc06c911f662fabc26b40cab9eb5 | |
parent | c720ff75d8c3512feed4f80635ebc3e0ed7abcc6 (diff) | |
download | rails-cc9958026409d7a4b76af555c0240db4428a071b.tar.gz rails-cc9958026409d7a4b76af555c0240db4428a071b.tar.bz2 rails-cc9958026409d7a4b76af555c0240db4428a071b.zip |
Added regression test for #8195.
-rw-r--r-- | activerecord/test/cases/cache_key_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/cache_key_test.rb b/activerecord/test/cases/cache_key_test.rb new file mode 100644 index 0000000000..e52bbd3d30 --- /dev/null +++ b/activerecord/test/cases/cache_key_test.rb @@ -0,0 +1,18 @@ +require "cases/helper" +require "models/invoice" +require "models/line_item" + +class CacheKeyTest < ActiveRecord::TestCase + def setup + @invoice = Invoice.create + LineItem.create(invoice: @invoice) + @invoice.reload + end + + def test_cache_key_changes_when_child_touched + key = @invoice.cache_key + @invoice.line_items[0].touch + @invoice.reload + assert_not_equal key, @invoice.cache_key + end +end |