Sha256: edc2c2b9e94ac6c34431af184a2ba6933ff91f57f7d611be6fbc4044c95b7a09
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
require "test_helper" class MemoizedAttributesTest < IdentityCache::TestCase def test_memoization_should_not_break_dirty_tracking_with_empty_cache item = Item.create! IdentityCache.cache.with_memoization do Item.fetch(item.id).title = "my title" Item.fetch(item.id).update!(title: "my title") end assert_equal "my title", Item.find(item.id).title end def test_memoization_should_not_break_dirty_tracking_with_filled_cache item = Item.create! IdentityCache.cache.with_memoization do Item.fetch(item.id) Item.fetch(item.id).title = "my title" Item.fetch(item.id).update!(title: "my title") end assert_equal "my title", Item.find(item.id).title end def test_memoization_with_fetch_multi_should_not_break_dirty_tracking_with_empty_cache item = Item.create! IdentityCache.cache.with_memoization do Item.fetch_multi(item.id).first.title = "my title" Item.fetch_multi(item.id).first.update!(title: "my title") end assert_equal "my title", Item.find(item.id).title end def test_memoization_with_fetch_multi_should_not_break_dirty_tracking_with_filled_cache item = Item.create! IdentityCache.cache.with_memoization do Item.fetch_multi(item.id) Item.fetch_multi(item.id).first.title = "my title" Item.fetch_multi(item.id).first.update!(title: "my title") end assert_equal "my title", Item.find(item.id).title end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
identity_cache-0.4.1 | test/memoized_attributes_test.rb |
identity_cache-0.4.0 | test/memoized_attributes_test.rb |
identity_cache-0.3.2 | test/memoized_attributes_test.rb |