test/transactions_test.rb in redis-3.0.1 vs test/transactions_test.rb in redis-3.0.2

- old
+ new

@@ -145,10 +145,20 @@ end assert_equal "s1", r.get("foo") end + def test_raise_command_error_when_exec_fails + redis_mock(:exec => lambda { |*_| "-ERROR" }) do |redis| + assert_raise(Redis::CommandError) do + redis.multi do |m| + m.set "foo", "s1" + end + end + end + end + def test_watch_with_an_unmodified_key r.watch "foo" r.multi do |multi| multi.set "foo", "s1" end @@ -186,23 +196,29 @@ assert_equal nil, res assert_equal "s1", r.get("foo") end def test_watch_with_a_block_and_an_unmodified_key - result = r.watch "foo" do - r.multi do |multi| + result = r.watch "foo" do |rd| + + assert_same r, rd + + rd.multi do |multi| multi.set "foo", "s1" end end assert_equal ["OK"], result assert_equal "s1", r.get("foo") end def test_watch_with_a_block_and_a_modified_key - result = r.watch "foo" do - r.set "foo", "s1" - r.multi do |multi| + result = r.watch "foo" do |rd| + + assert_same r, rd + + rd.set "foo", "s1" + rd.multi do |multi| multi.set "foo", "s2" end end assert_equal nil, result