diff --git a/lib/redis/pipeline.rb b/lib/redis/pipeline.rb index 707df2ec2..dd62bdc18 100644 --- a/lib/redis/pipeline.rb +++ b/lib/redis/pipeline.rb @@ -132,6 +132,9 @@ class Future < BasicObject attr_reader :timeout + # Avoid allowing people to use == inside a pipelined + undef :== + def initialize(command, transformation, timeout) @command = command @transformation = transformation @@ -161,6 +164,7 @@ def is_a?(other) self.class.ancestors.include?(other) end + def class Future end diff --git a/test/pipelining_commands_test.rb b/test/pipelining_commands_test.rb index 32a6a6389..fb5904733 100644 --- a/test/pipelining_commands_test.rb +++ b/test/pipelining_commands_test.rb @@ -126,6 +126,14 @@ def test_futures_raise_when_trying_to_access_their_values_too_early end end + def test_futures_raise_when_trying_to_compare_their_value_too_early + r.pipelined do + assert_raises(NoMethodError) do + r.sadd("foo", 1) == 1 + end + end + end + def test_futures_raise_when_command_errors_and_needs_transformation assert_raises(Redis::CommandError) do r.pipelined do