Commit 95303b07 authored by Rajko Albrecht's avatar Rajko Albrecht

check keys to change in cas_multi

parent c5011f2a
......@@ -25,7 +25,7 @@ class Redis
valuehash = yield values
ires = multi do |multi|
valuehash.map do |name,value|
multi.set(name,value,options)
multi.set(name,value,options) if values.key?(name)
end
end
true
......
......@@ -61,5 +61,20 @@ describe Redis::Store::StoreWithCas do
end)
end
def test_cas_multi_with_altered_key
@store.set('foo', 'baz')
assert @store.cas_multi('foo') { |_hash| { 'fu' => 'baz' } }
assert_nil @store.get('fu')
assert_equal 'baz', @store.get('foo')
end
def test_cas_multi_with_partial_miss
@store.set('foo', 'baz')
assert(@store.cas_multi('foo', 'bar') do |hash|
assert_equal({ "foo" => "baz" }, hash)
{}
end)
assert_equal 'baz', @store.get('foo')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment