spec/redis_spec.rb in em-synchrony-0.3.0.beta.1 vs spec/redis_spec.rb in em-synchrony-1.0.0
- old
+ new
@@ -21,10 +21,23 @@
EM.stop
end
end
+ it "should mapped_mget synchronously" do
+ EventMachine.synchrony do
+ redis = EM::Protocols::Redis.connect
+
+ redis.set('mmget1', 'value1')
+ redis.set('mmget3', 'value3')
+ redis.mapped_mget('mmget1', 'mmget2', 'mmget3').should ==
+ { 'mmget1' => 'value1', 'mmget3' => 'value3' }
+
+ EM.stop
+ end
+ end
+
it "should incr/decr key synchronously" do
EventMachine.synchrony do
redis = EM::Protocols::Redis.connect
redis.delete('key')
@@ -59,8 +72,34 @@
resp.to_i.should == 2
EM.stop
end
end
end
+ end
+ end
+
+ it "should execute async mapped_mget" do
+ EventMachine.synchrony do
+ redis = EM::Protocols::Redis.connect
+
+ redis.aset('some_key', 'some_value') do
+ redis.amapped_mget('some_key', 'some_other_key') do |values|
+ values.should == { 'some_key' => 'some_value' }
+ EM.stop
+ end
+ end
+ end
+ end
+
+ it "should execute sync add and auth" do
+ EventMachine.synchrony do
+ redis = EM::Protocols::Redis.connect
+ redis.auth('abc')
+
+ redis.delete('key')
+ redis.add('key', 'value')
+ redis.scard('key').should == 1
+
+ EM.stop
end
end
end
\ No newline at end of file