aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/rack_cache_test.rb
blob: 86b375a2a8008b16c460ea1e1572ce9570bd06b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require "abstract_unit"
require "action_dispatch/http/rack_cache"

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
    @store.write(:foo, bar: :original)
    hash = @store.read(:foo)
    hash[:bar] = :changed
    hash = @store.read(:foo)
    assert_equal :original, hash[:bar]
  end
end