Sha256: be6cdd1d22249db2440adba4d086cfe0d9341f4f232e632c6332169a00cfb29c

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

# encoding: UTF-8

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

setup do
  init Redis.new(OPTIONS)
end

test "Override existing commands" do |r|
  r.set("counter", 1)

  assert 2 == r.incr("counter")

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

  assert 1 == r.incr("counter")
end

test "Override non-existing commands" do |r|
  r.set("key", "value")

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

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

  assert "value" == r.idontexist("key")
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
gorsuch-redis-3.0.0.rc1 test/command_map_test.rb
redis-3.0.0.rc1 test/command_map_test.rb