test/caching_test.rb in autobots-0.2.2 vs test/caching_test.rb in autobots-0.2.3
- old
+ new
@@ -43,6 +43,23 @@
end
assert_equal expected_data, data
end
+ def test_cache_key_contains_associations
+ cache = ActiveSupport::Cache::MemoryStore.new
+ projects = Project.all
+ assembler = ProjectPreloadIncludedAssembler.new(projects, cache: cache)
+ cache_key_with_associations = assembler.send(:serializer_cache_key)
+
+ saved_associations = assembler.serializer._associations
+ assembler.serializer._associations = {}
+ assembler.remove_instance_variable(:@serializer_cache_key)
+
+ cache_key_without_associations = assembler.send(:serializer_cache_key)
+
+ assembler.serializer._associations = saved_associations
+
+ assert_not_equal cache_key_with_associations, cache_key_without_associations
+ end
+
end
\ No newline at end of file