Sha256: 86a94a749e0e95a055d468596bd11780042c638e5b87d751ceb77fa1f4a892d0
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require "test_helper" class MemoizedAttributesTest < IdentityCache::TestCase def setup IdentityCache.fetch_read_only_records = false super end def teardown super IdentityCache.fetch_read_only_records = true end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
identity_cache-0.5.1 | test/memoized_attributes_test.rb |
identity_cache-0.5.0 | test/memoized_attributes_test.rb |