@@ -102,13 +102,13 @@ def test_cache_key_interpolation_with_updated_at_when_cache_key_is_not_defined_o
102102
103103 render_object_with_cache ( uncached_author )
104104 key = "#{ uncached_author_serializer . class . _cache_key } /#{ uncached_author_serializer . object . id } -#{ uncached_author_serializer . object . updated_at . strftime ( "%Y%m%d%H%M%S%9N" ) } "
105- key = "#{ key } /#{ adapter . cached_name } "
105+ key = "#{ key } /#{ adapter . cache_key } "
106106 assert_equal ( uncached_author_serializer . attributes . to_json , cache_store . fetch ( key ) . to_json )
107107 end
108108
109109 def test_default_cache_key_fallback
110110 render_object_with_cache ( @comment )
111- key = "#{ @comment . cache_key } /#{ adapter . cached_name } "
111+ key = "#{ @comment . cache_key } /#{ adapter . cache_key } "
112112 assert_equal ( @comment_serializer . attributes . to_json , cache_store . fetch ( key ) . to_json )
113113 end
114114
@@ -139,9 +139,9 @@ def test_associations_separately_cache
139139 Timecop . freeze ( Time . current ) do
140140 render_object_with_cache ( @post )
141141
142- key = "#{ @post . cache_key } /#{ adapter . cached_name } "
142+ key = "#{ @post . cache_key } /#{ adapter . cache_key } "
143143 assert_equal ( @post_serializer . attributes , cache_store . fetch ( key ) )
144- key = "#{ @comment . cache_key } /#{ adapter . cached_name } "
144+ key = "#{ @comment . cache_key } /#{ adapter . cache_key } "
145145 assert_equal ( @comment_serializer . attributes , cache_store . fetch ( key ) )
146146 end
147147 end
@@ -152,9 +152,9 @@ def test_associations_cache_when_updated
152152 render_object_with_cache ( @post )
153153
154154 # Check if it cached the objects separately
155- key = "#{ @post . cache_key } /#{ adapter . cached_name } "
155+ key = "#{ @post . cache_key } /#{ adapter . cache_key } "
156156 assert_equal ( @post_serializer . attributes , cache_store . fetch ( key ) )
157- key = "#{ @comment . cache_key } /#{ adapter . cached_name } "
157+ key = "#{ @comment . cache_key } /#{ adapter . cache_key } "
158158 assert_equal ( @comment_serializer . attributes , cache_store . fetch ( key ) )
159159
160160 # Simulating update on comments relationship with Post
@@ -166,9 +166,9 @@ def test_associations_cache_when_updated
166166 render_object_with_cache ( @post )
167167
168168 # Check if the the new comment was cached
169- key = "#{ new_comment . cache_key } /#{ adapter . cached_name } "
169+ key = "#{ new_comment . cache_key } /#{ adapter . cache_key } "
170170 assert_equal ( new_comment_serializer . attributes , cache_store . fetch ( key ) )
171- key = "#{ @post . cache_key } /#{ adapter . cached_name } "
171+ key = "#{ @post . cache_key } /#{ adapter . cache_key } "
172172 assert_equal ( @post_serializer . attributes , cache_store . fetch ( key ) )
173173 end
174174 end
@@ -184,7 +184,7 @@ def test_fragment_fetch_with_virtual_associations
184184 hash = render_object_with_cache ( @location )
185185
186186 assert_equal ( hash , expected_result )
187- key = "#{ @location . cache_key } /#{ adapter . cached_name } "
187+ key = "#{ @location . cache_key } /#{ adapter . cache_key } "
188188 assert_equal ( { place : 'Nowhere' } , cache_store . fetch ( key ) )
189189 end
190190
@@ -276,7 +276,7 @@ def test_a_serializer_rendered_by_two_adapter_returns_differently_cached_attribu
276276
277277 def test_uses_file_digest_in_cache_key
278278 render_object_with_cache ( @blog )
279- key = "#{ @blog . cache_key } /#{ adapter . cached_name } /#{ ::Model ::FILE_DIGEST } "
279+ key = "#{ @blog . cache_key } /#{ adapter . cache_key } /#{ ::Model ::FILE_DIGEST } "
280280 assert_equal ( @blog_serializer . attributes , cache_store . fetch ( key ) )
281281 end
282282
@@ -291,7 +291,7 @@ def test_object_cache_keys
291291 actual = ActiveModel ::Serializer . object_cache_keys ( serializable . adapter . serializer , serializable . adapter , include_directive )
292292
293293 assert_equal 3 , actual . size
294- assert actual . any? { |key | key == "comment/1/#{ serializable . adapter . cached_name } " }
294+ assert actual . any? { |key | key == "comment/1/#{ serializable . adapter . cache_key } " }
295295 assert actual . any? { |key | key =~ %r{post/post-\d +} }
296296 assert actual . any? { |key | key =~ %r{author/author-\d +} }
297297 end
@@ -306,13 +306,13 @@ def test_cached_attributes
306306 include_directive = ActiveModelSerializers . default_include_directive
307307 cached_attributes = ActiveModel ::Serializer . cache_read_multi ( serializer , attributes , include_directive )
308308
309- assert_equal cached_attributes [ "#{ @comment . cache_key } /#{ attributes . cached_name } " ] , Comment . new ( id : 1 , body : 'ZOMG A COMMENT' ) . attributes
310- assert_equal cached_attributes [ "#{ @comment . post . cache_key } /#{ attributes . cached_name } " ] , Post . new ( id : 'post' , title : 'New Post' , body : 'Body' ) . attributes
309+ assert_equal cached_attributes [ "#{ @comment . cache_key } /#{ attributes . cache_key } " ] , Comment . new ( id : 1 , body : 'ZOMG A COMMENT' ) . attributes
310+ assert_equal cached_attributes [ "#{ @comment . post . cache_key } /#{ attributes . cache_key } " ] , Post . new ( id : 'post' , title : 'New Post' , body : 'Body' ) . attributes
311311
312312 writer = @comment . post . blog . writer
313313 writer_cache_key = writer . cache_key
314314
315- assert_equal cached_attributes [ "#{ writer_cache_key } /#{ attributes . cached_name } " ] , Author . new ( id : 'author' , name : 'Joao M. D. Moura' ) . attributes
315+ assert_equal cached_attributes [ "#{ writer_cache_key } /#{ attributes . cache_key } " ] , Author . new ( id : 'author' , name : 'Joao M. D. Moura' ) . attributes
316316 end
317317 end
318318
0 commit comments