spec/commands/brpoplpush_spec.rb in mock_redis-0.12.1 vs spec/commands/brpoplpush_spec.rb in mock_redis-0.13.0
- old
+ new
@@ -13,35 +13,35 @@
@redises.rpush(@list2, 'alpha')
@redises.rpush(@list2, 'beta')
end
it "takes the last element of source and prepends it to destination" do
- @redises.brpoplpush(@list1, @list2, 0)
+ @redises.brpoplpush(@list1, @list2)
@redises.lrange(@list1, 0, -1).should == %w[A]
@redises.lrange(@list2, 0, -1).should == %w[B alpha beta]
end
it "returns the moved element" do
- @redises.brpoplpush(@list1, @list2, 0).should == "B"
+ @redises.brpoplpush(@list1, @list2).should == "B"
end
it "raises an error on negative timeout" do
lambda do
- @redises.brpoplpush(@list1, @list2, -1)
+ @redises.brpoplpush(@list1, @list2, :timeout => -1)
end.should raise_error(Redis::CommandError)
end
it_should_behave_like "a list-only command"
context "[mock only]" do
it "ignores positive timeouts and returns nil" do
- @redises.mock.brpoplpush('mock-redis-test:not-here', @list1, 1).
+ @redises.mock.brpoplpush('mock-redis-test:not-here', @list1, :timeout => 1).
should be_nil
end
it "raises WouldBlock on zero timeout (no blocking in the mock)" do
lambda do
- @redises.mock.brpoplpush('mock-redis-test:not-here', @list1, 0)
+ @redises.mock.brpoplpush('mock-redis-test:not-here', @list1, :timeout => 0)
end.should raise_error(MockRedis::WouldBlock)
end
end
end