2016-08-06 12:54:50 -04:00
|
|
|
require "abstract_unit"
|
|
|
|
require "action_dispatch/http/rack_cache"
|
2011-05-17 17:32:52 -04:00
|
|
|
|
|
|
|
class RackCacheMetaStoreTest < ActiveSupport::TestCase
|
|
|
|
class ReadWriteHash < ::Hash
|
|
|
|
alias :read :[]
|
|
|
|
alias :write :[]=
|
|
|
|
end
|
|
|
|
|
|
|
|
setup do
|
|
|
|
@store = ActionDispatch::RailsMetaStore.new(ReadWriteHash.new)
|
|
|
|
end
|
|
|
|
|
|
|
|
test "stuff is deep duped" do
|
2016-08-06 13:35:13 -04:00
|
|
|
@store.write(:foo, { bar: :original })
|
2011-05-17 17:32:52 -04:00
|
|
|
hash = @store.read(:foo)
|
|
|
|
hash[:bar] = :changed
|
|
|
|
hash = @store.read(:foo)
|
|
|
|
assert_equal :original, hash[:bar]
|
|
|
|
end
|
|
|
|
end
|