Sha256: 682f0d131ab171050130c7499c83353ca2bfa2420cf8f230ddbf77049f53d1ed

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

# encoding: UTF-8

require File.expand_path("helper", File.dirname(__FILE__))

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 Redis2::CommandError do
      r.idontexist("key")
    end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redis2-namespaced-3.0.7.1 test/command_map_test.rb
redis2-namespaced-3.0.7 test/command_map_test.rb