mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Original cache objects should not be immutable [#2860 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
This commit is contained in:
parent
16dc139caa
commit
1026d7706f
2 changed files with 7 additions and 1 deletions
|
@ -26,7 +26,7 @@ module ActiveSupport
|
|||
|
||||
def write(name, value, options = nil)
|
||||
super
|
||||
@data[name] = value.freeze
|
||||
@data[name] = (value.duplicable? ? value.dup : value).freeze
|
||||
end
|
||||
|
||||
def delete(name, options = nil)
|
||||
|
|
|
@ -176,6 +176,12 @@ class MemoryStoreTest < ActiveSupport::TestCase
|
|||
assert_raise(ActiveSupport::FrozenObjectError) { @cache.read('foo').gsub!(/.*/, 'baz') }
|
||||
assert_equal 'bar', @cache.read('foo')
|
||||
end
|
||||
|
||||
def test_original_store_objects_should_not_be_immutable
|
||||
bar = 'bar'
|
||||
@cache.write('foo', bar)
|
||||
assert_nothing_raised { bar.gsub!(/.*/, 'baz') }
|
||||
end
|
||||
end
|
||||
|
||||
uses_memcached 'memcached backed store' do
|
||||
|
|
Loading…
Reference in a new issue