Skip to content

Instantly share code, notes, and snippets.

@eugeneius
Last active November 14, 2015 02:56
Show Gist options
  • Save eugeneius/e644d420da97dfc0b920 to your computer and use it in GitHub Desktop.
Save eugeneius/e644d420da97dfc0b920 to your computer and use it in GitHub Desktop.
Demonstrates a bug in the identity_cache gem: https://github.com/Shopify/identity_cache/issues/246
require "test_helper"
class MemoizedAttributesTest < IdentityCache::TestCase
def test_memoization_should_not_break_dirty_tracking
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")
assert_equal "my title", Item.find(item.id).title
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment