spec/transactions_spec.rb in mock_redis-0.23.0 vs spec/transactions_spec.rb in mock_redis-0.24.0
- old
+ new
@@ -65,9 +65,25 @@
end
end
@redises.get('counter').should eq '6'
@redises.get('test').should eq '1'
end
+
+ it 'allows blocks within multi blocks' do
+ @redises.set('foo', 'bar')
+ @redises.set('fuu', 'baz')
+
+ result = nil
+
+ @redises.multi do |r|
+ result = r.mget('foo', 'fuu') { |reply| reply.map(&:upcase) }
+ r.del('foo', 'fuu')
+ end
+
+ result.value.should eq %w[BAR BAZ]
+ @redises.get('foo').should eq nil
+ @redises.get('fuu').should eq nil
+ end
end
context '#discard' do
it "responds with 'OK' after #multi" do
@redises.multi