Sha256: 2c1349f64c8903c41d6006b74420a073eb87a24c2657af6a536863716b42a5fc

Contents?: true

Size: 534 Bytes

Versions: 6

Compression:

Stored size: 534 Bytes

Contents

require_relative "helper"

class TestCommandMap < Test::Unit::TestCase

  include Helper::Client

  def test_override_existing_commands
    r.set("counter", 1)

    assert_equal 2, r.incr("counter")

    r._client.command_map[:incr] = :decr

    assert_equal 1, r.incr("counter")
  end

  def test_override_non_existing_commands
    r.set("key", "value")

    assert_raise Redis::CommandError do
      r.idontexist("key")
    end

    r._client.command_map[:idontexist] = :get

    assert_equal "value", r.idontexist("key")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
redis-4.0.3 test/command_map_test.rb
redis-4.1.0.beta1 test/command_map_test.rb
redis-4.0.2 test/command_map_test.rb
redis-4.0.1 test/command_map_test.rb
redis-4.0.0 test/command_map_test.rb
redis-4.0.0.rc1 test/command_map_test.rb