test/unit/connection_spy_tests.rb in hella-redis-0.2.1 vs test/unit/connection_spy_tests.rb in hella-redis-0.3.0
- old
+ new
@@ -64,11 +64,11 @@
setup do
@redis_spy = HellaRedis::RedisSpy.new(@config)
end
subject{ @redis_spy }
- should have_readers :calls
+ should have_readers :pipelined, :multi, :calls
should "default its calls" do
assert_equal [], subject.calls
end
@@ -84,9 +84,19 @@
subject.set(key, value)
call = subject.calls.first
assert_equal :set, call.command
assert_equal [key, value], call.args
+ end
+
+ should "track the call and yield itself using `pipelined`" do
+ subject.pipelined{ |c| c.set(Factory.string, Factory.string) }
+ assert_equal [:pipelined, :set], subject.calls.map(&:command)
+ end
+
+ should "track the call and yield itself using `multi`" do
+ subject.multi{ |c| c.set(Factory.string, Factory.string) }
+ assert_equal [:multi, :set], subject.calls.map(&:command)
end
should "raise no method errors for non-redis methods" do
assert_false subject.respond_to?(:super_awesome_set)
assert_raises(NoMethodError) do