Cleaning up Caching Tests

This commit is contained in:
Benjamin Fleischer
2016-03-30 02:20:15 -05:00
parent cdab6f2b8a
commit d50d29b601
3 changed files with 42 additions and 32 deletions

14
test/fixtures/poro.rb vendored
View File

@@ -1,8 +1,6 @@
verbose = $VERBOSE
$VERBOSE = nil
class Model < ActiveModelSerializers::Model
FILE_DIGEST = Digest::MD5.hexdigest(File.open(__FILE__).read)
### Helper methods, not required to be serializable
# Convenience when not adding @attributes readers and writers
@@ -21,10 +19,6 @@ class Model < ActiveModelSerializers::Model
def respond_to_missing?(method_name, _include_private = false)
attributes.key?(method_name.to_s.tr('=', '').to_sym) || super
end
def cache_key_with_digest
"#{cache_key}/#{FILE_DIGEST}"
end
end
# see
@@ -58,7 +52,13 @@ Post = Class.new(Model)
Like = Class.new(Model)
Author = Class.new(Model)
Bio = Class.new(Model)
Blog = Class.new(Model)
Blog = Class.new(Model) do
FILE_DIGEST = Digest::MD5.hexdigest(File.open(__FILE__).read)
def cache_key_with_digest
"#{cache_key}/#{FILE_DIGEST}"
end
end
Role = Class.new(Model)
User = Class.new(Model)
Location = Class.new(Model)