mock_redis 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/Gemfile +9 -0
- data/LICENSE +19 -0
- data/README.md +88 -0
- data/Rakefile +10 -0
- data/lib/mock_redis/assertions.rb +13 -0
- data/lib/mock_redis/database.rb +432 -0
- data/lib/mock_redis/exceptions.rb +3 -0
- data/lib/mock_redis/expire_wrapper.rb +25 -0
- data/lib/mock_redis/hash_methods.rb +102 -0
- data/lib/mock_redis/list_methods.rb +187 -0
- data/lib/mock_redis/multi_db_wrapper.rb +48 -0
- data/lib/mock_redis/set_methods.rb +125 -0
- data/lib/mock_redis/string_methods.rb +195 -0
- data/lib/mock_redis/transaction_wrapper.rb +75 -0
- data/lib/mock_redis/undef_redis_methods.rb +11 -0
- data/lib/mock_redis/utility_methods.rb +22 -0
- data/lib/mock_redis/version.rb +3 -0
- data/lib/mock_redis/zset.rb +80 -0
- data/lib/mock_redis/zset_methods.rb +210 -0
- data/lib/mock_redis.rb +32 -0
- data/mock_redis.gemspec +24 -0
- data/spec/cloning_spec.rb +96 -0
- data/spec/commands/append_spec.rb +24 -0
- data/spec/commands/auth_spec.rb +7 -0
- data/spec/commands/bgrewriteaof_spec.rb +7 -0
- data/spec/commands/bgsave_spec.rb +7 -0
- data/spec/commands/blpop_spec.rb +55 -0
- data/spec/commands/brpop_spec.rb +54 -0
- data/spec/commands/brpoplpush_spec.rb +53 -0
- data/spec/commands/dbsize_spec.rb +18 -0
- data/spec/commands/decr_spec.rb +34 -0
- data/spec/commands/decrby_spec.rb +34 -0
- data/spec/commands/del_spec.rb +20 -0
- data/spec/commands/echo_spec.rb +11 -0
- data/spec/commands/exists_spec.rb +14 -0
- data/spec/commands/expire_spec.rb +83 -0
- data/spec/commands/expireat_spec.rb +48 -0
- data/spec/commands/flushall_spec.rb +38 -0
- data/spec/commands/flushdb_spec.rb +38 -0
- data/spec/commands/get_spec.rb +23 -0
- data/spec/commands/getbit_spec.rb +34 -0
- data/spec/commands/getrange_spec.rb +22 -0
- data/spec/commands/getset_spec.rb +23 -0
- data/spec/commands/hdel_spec.rb +35 -0
- data/spec/commands/hexists_spec.rb +22 -0
- data/spec/commands/hget_spec.rb +23 -0
- data/spec/commands/hgetall_spec.rb +22 -0
- data/spec/commands/hincrby_spec.rb +52 -0
- data/spec/commands/hkeys_spec.rb +19 -0
- data/spec/commands/hlen_spec.rb +19 -0
- data/spec/commands/hmget_spec.rb +30 -0
- data/spec/commands/hmset_spec.rb +43 -0
- data/spec/commands/hset_spec.rb +23 -0
- data/spec/commands/hsetnx_spec.rb +39 -0
- data/spec/commands/hvals_spec.rb +19 -0
- data/spec/commands/incr_spec.rb +34 -0
- data/spec/commands/incrby_spec.rb +44 -0
- data/spec/commands/info_spec.rb +13 -0
- data/spec/commands/keys_spec.rb +87 -0
- data/spec/commands/lastsave_spec.rb +8 -0
- data/spec/commands/lindex_spec.rb +39 -0
- data/spec/commands/linsert_spec.rb +68 -0
- data/spec/commands/llen_spec.rb +16 -0
- data/spec/commands/lpop_spec.rb +34 -0
- data/spec/commands/lpush_spec.rb +30 -0
- data/spec/commands/lpushx_spec.rb +33 -0
- data/spec/commands/lrange_spec.rb +35 -0
- data/spec/commands/lrem_spec.rb +79 -0
- data/spec/commands/lset_spec.rb +38 -0
- data/spec/commands/ltrim_spec.rb +35 -0
- data/spec/commands/mget_spec.rb +34 -0
- data/spec/commands/mset_spec.rb +29 -0
- data/spec/commands/msetnx_spec.rb +40 -0
- data/spec/commands/persist_spec.rb +49 -0
- data/spec/commands/ping_spec.rb +7 -0
- data/spec/commands/quit_spec.rb +7 -0
- data/spec/commands/randomkey_spec.rb +20 -0
- data/spec/commands/rename_spec.rb +31 -0
- data/spec/commands/renamenx_spec.rb +36 -0
- data/spec/commands/rpop_spec.rb +34 -0
- data/spec/commands/rpoplpush_spec.rb +45 -0
- data/spec/commands/rpush_spec.rb +30 -0
- data/spec/commands/rpushx_spec.rb +33 -0
- data/spec/commands/sadd_spec.rb +22 -0
- data/spec/commands/save_spec.rb +7 -0
- data/spec/commands/scard_spec.rb +18 -0
- data/spec/commands/sdiff_spec.rb +47 -0
- data/spec/commands/sdiffstore_spec.rb +51 -0
- data/spec/commands/select_spec.rb +53 -0
- data/spec/commands/set_spec.rb +7 -0
- data/spec/commands/setbit_spec.rb +46 -0
- data/spec/commands/setex_spec.rb +22 -0
- data/spec/commands/setnx_spec.rb +25 -0
- data/spec/commands/setrange_spec.rb +30 -0
- data/spec/commands/sinter_spec.rb +41 -0
- data/spec/commands/sinterstore_spec.rb +46 -0
- data/spec/commands/sismember_spec.rb +29 -0
- data/spec/commands/smembers_spec.rb +18 -0
- data/spec/commands/smove_spec.rb +41 -0
- data/spec/commands/spop_spec.rb +25 -0
- data/spec/commands/srandmember_spec.rb +25 -0
- data/spec/commands/srem_spec.rb +35 -0
- data/spec/commands/strlen_spec.rb +19 -0
- data/spec/commands/sunion_spec.rb +40 -0
- data/spec/commands/sunionstore_spec.rb +46 -0
- data/spec/commands/ttl_spec.rb +36 -0
- data/spec/commands/type_spec.rb +36 -0
- data/spec/commands/unwatch_spec.rb +7 -0
- data/spec/commands/watch_spec.rb +7 -0
- data/spec/commands/zadd_spec.rb +29 -0
- data/spec/commands/zcard_spec.rb +19 -0
- data/spec/commands/zcount_spec.rb +23 -0
- data/spec/commands/zincrby_spec.rb +24 -0
- data/spec/commands/zinterstore_spec.rb +88 -0
- data/spec/commands/zrange_spec.rb +31 -0
- data/spec/commands/zrangebyscore_spec.rb +42 -0
- data/spec/commands/zrank_spec.rb +23 -0
- data/spec/commands/zrem_spec.rb +25 -0
- data/spec/commands/zremrangebyrank_spec.rb +22 -0
- data/spec/commands/zremrangebyscore_spec.rb +21 -0
- data/spec/commands/zrevrange_spec.rb +31 -0
- data/spec/commands/zrevrangebyscore_spec.rb +42 -0
- data/spec/commands/zrevrank_spec.rb +23 -0
- data/spec/commands/zscore_spec.rb +16 -0
- data/spec/commands/zunionstore_spec.rb +96 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/redis_multiplexer.rb +91 -0
- data/spec/support/shared_examples/only_operates_on_hashes.rb +13 -0
- data/spec/support/shared_examples/only_operates_on_lists.rb +13 -0
- data/spec/support/shared_examples/only_operates_on_sets.rb +13 -0
- data/spec/support/shared_examples/only_operates_on_strings.rb +13 -0
- data/spec/support/shared_examples/only_operates_on_zsets.rb +57 -0
- data/spec/transactions_spec.rb +73 -0
- metadata +358 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'redis'
|
3
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "..", "..", "lib")))
|
4
|
+
require 'mock_redis'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..')))
|
7
|
+
Dir["spec/support/**/*.rb"].each {|x| require x}
|
8
|
+
|
9
|
+
module TypeCheckingHelper
|
10
|
+
def method_from_description
|
11
|
+
# extracting this from the RSpec description string may or may not
|
12
|
+
# be a good idea. On the one hand, it enforces the convention of
|
13
|
+
# putting the method name in the right place; on the other hand,
|
14
|
+
# it's pretty magic-looking.
|
15
|
+
self.example.full_description.match(/#(\w+)/).captures.first
|
16
|
+
end
|
17
|
+
|
18
|
+
def args_for_method(method)
|
19
|
+
method_arity = @redises.real.method(method).arity
|
20
|
+
if method_arity < 0 # -1 comes from def foo(*args)
|
21
|
+
[1, 2] # probably good enough
|
22
|
+
else
|
23
|
+
1.upto(method_arity - 1).to_a
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
config.include(TypeCheckingHelper)
|
30
|
+
|
31
|
+
config.before(:all) do
|
32
|
+
@redises = RedisMultiplexer.new
|
33
|
+
end
|
34
|
+
|
35
|
+
config.before(:each) do
|
36
|
+
# databases mentioned in our tests
|
37
|
+
[1, 0].each do |db|
|
38
|
+
@redises.send_without_checking(:select, db)
|
39
|
+
@redises.send_without_checking(:keys, "mock-redis-test:*").each do |key|
|
40
|
+
@redises.send_without_checking(:del, key)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
class BlankSlate
|
2
|
+
instance_methods.each {|m| undef_method(m) unless m =~ /^__/ || ['inspect', 'object_id'].include?(m.to_s)}
|
3
|
+
end
|
4
|
+
|
5
|
+
class RedisMultiplexer < BlankSlate
|
6
|
+
MismatchedResponse = Class.new(StandardError)
|
7
|
+
|
8
|
+
def initialize(*a)
|
9
|
+
@mock_redis = MockRedis.new(*a)
|
10
|
+
@real_redis = Redis.new(*a)
|
11
|
+
end
|
12
|
+
|
13
|
+
def method_missing(method, *args, &blk)
|
14
|
+
mock_retval, mock_error = catch_errors { @mock_redis.send(method, *args, &blk) }
|
15
|
+
real_retval, real_error = catch_errors { @real_redis.send(method, *args, &blk) }
|
16
|
+
|
17
|
+
mock_retval = handle_special_cases(method, mock_retval)
|
18
|
+
real_retval = handle_special_cases(method, real_retval)
|
19
|
+
|
20
|
+
if (!equalish?(mock_retval, real_retval) && !mock_error && !real_error)
|
21
|
+
# no exceptions, just different behavior
|
22
|
+
raise MismatchedResponse,
|
23
|
+
"Mock failure: responses not equal.\n" +
|
24
|
+
"Redis.#{method}(#{args.inspect}) returned #{real_retval.inspect}\n" +
|
25
|
+
"MockRedis.#{method}(#{args.inspect}) returned #{mock_retval.inspect}\n"
|
26
|
+
elsif (!mock_error && real_error)
|
27
|
+
raise MismatchedResponse,
|
28
|
+
"Mock failure: didn't raise an error when it should have.\n" +
|
29
|
+
"Redis.#{method}(#{args.inspect}) raised #{real_error.inspect}\n" +
|
30
|
+
"MockRedis.#{method}(#{args.inspect}) raised nothing " +
|
31
|
+
"and returned #{mock_retval.inspect}"
|
32
|
+
elsif (!real_error && mock_error)
|
33
|
+
raise MismatchedResponse,
|
34
|
+
"Mock failure: raised an error when it shouldn't have.\n" +
|
35
|
+
"Redis.#{method}(#{args.inspect}) returned #{real_retval.inspect}\n" +
|
36
|
+
"MockRedis.#{method}(#{args.inspect}) raised #{mock_error.inspect}"
|
37
|
+
elsif (mock_error && real_error && !equalish?(mock_error, real_error))
|
38
|
+
raise MismatchedResponse,
|
39
|
+
"Mock failure: raised the wrong error.\n" +
|
40
|
+
"Redis.#{method}(#{args.inspect}) raised #{real_error.inspect}\n" +
|
41
|
+
"MockRedis.#{method}(#{args.inspect}) raised #{mock_error.inspect}"
|
42
|
+
end
|
43
|
+
|
44
|
+
raise mock_error if mock_error
|
45
|
+
mock_retval
|
46
|
+
end
|
47
|
+
|
48
|
+
def equalish?(a, b)
|
49
|
+
if a == b
|
50
|
+
true
|
51
|
+
elsif a.is_a?(Array) && b.is_a?(Array)
|
52
|
+
a.zip(b).all? {|(x,y)| equalish?(x,y)}
|
53
|
+
elsif a.is_a?(Exception) && b.is_a?(Exception)
|
54
|
+
a.class == b.class && a.message == b.message
|
55
|
+
else
|
56
|
+
false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def mock() @mock_redis end
|
61
|
+
def real() @real_redis end
|
62
|
+
|
63
|
+
# Some commands require special handling due to nondeterminism in
|
64
|
+
# the returned values.
|
65
|
+
def handle_special_cases(method, value)
|
66
|
+
case method.to_s
|
67
|
+
when 'keys', 'hkeys', 'sdiff', 'sinter', 'smembers', 'sunion'
|
68
|
+
# The order is irrelevant, but [a,b] != [b,a] in Ruby, so we
|
69
|
+
# sort the returned values so we can ignore the order.
|
70
|
+
value.sort if value
|
71
|
+
else
|
72
|
+
value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Used in cleanup before() blocks.
|
77
|
+
def send_without_checking(method, *args)
|
78
|
+
@mock_redis.send(method, *args)
|
79
|
+
@real_redis.send(method, *args)
|
80
|
+
end
|
81
|
+
|
82
|
+
def catch_errors
|
83
|
+
begin
|
84
|
+
retval = yield
|
85
|
+
[retval, nil]
|
86
|
+
rescue StandardError => e
|
87
|
+
[nil, e]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
shared_examples_for "a hash-only command" do
|
2
|
+
it "raises an error for non-hash values" do
|
3
|
+
key = 'mock-redis-test:hash-only'
|
4
|
+
|
5
|
+
method = method_from_description
|
6
|
+
args = args_for_method(method).unshift(key)
|
7
|
+
|
8
|
+
@redises.set(key, 1)
|
9
|
+
lambda do
|
10
|
+
@redises.send(method, *args)
|
11
|
+
end.should raise_error(RuntimeError)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
shared_examples_for "a list-only command" do
|
2
|
+
it "raises an error for non-list values" do
|
3
|
+
key = 'mock-redis-test:list-only'
|
4
|
+
|
5
|
+
method = method_from_description
|
6
|
+
args = args_for_method(method).unshift(key)
|
7
|
+
|
8
|
+
@redises.set(key, 1)
|
9
|
+
lambda do
|
10
|
+
@redises.send(method, *args)
|
11
|
+
end.should raise_error(RuntimeError)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
shared_examples_for "a set-only command" do
|
2
|
+
it "raises an error for non-set values" do
|
3
|
+
key = 'mock-redis-test:set-only'
|
4
|
+
|
5
|
+
method = method_from_description
|
6
|
+
args = args_for_method(method).unshift(key)
|
7
|
+
|
8
|
+
@redises.set(key, 1)
|
9
|
+
lambda do
|
10
|
+
@redises.send(method, *args)
|
11
|
+
end.should raise_error(RuntimeError)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
shared_examples_for "a string-only command" do
|
2
|
+
it "raises an error for non-string values" do
|
3
|
+
key = "mock-redis-test:string-only-command"
|
4
|
+
|
5
|
+
method = method_from_description
|
6
|
+
args = args_for_method(method).unshift(key)
|
7
|
+
|
8
|
+
@redises.lpush(key, 1)
|
9
|
+
lambda do
|
10
|
+
@redises.send(method, *args)
|
11
|
+
end.should raise_error(RuntimeError)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
shared_examples_for "a zset-only command" do
|
2
|
+
it "raises an error for non-zset values" do
|
3
|
+
key = 'mock-redis-test:zset-only'
|
4
|
+
|
5
|
+
method = method_from_description
|
6
|
+
args = args_for_method(method).unshift(key)
|
7
|
+
|
8
|
+
@redises.set(key, 1)
|
9
|
+
lambda do
|
10
|
+
@redises.send(method, *args)
|
11
|
+
end.should raise_error(RuntimeError)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
shared_examples_for "arg 1 is a score" do
|
16
|
+
before { @_arg_index = 1 }
|
17
|
+
it_should_behave_like "arg N is a score"
|
18
|
+
end
|
19
|
+
|
20
|
+
shared_examples_for "arg 2 is a score" do
|
21
|
+
before { @_arg_index = 2 }
|
22
|
+
it_should_behave_like "arg N is a score"
|
23
|
+
end
|
24
|
+
|
25
|
+
shared_examples_for "arg N is a score" do
|
26
|
+
before do
|
27
|
+
key = 'mock-redis-test:zset-only'
|
28
|
+
|
29
|
+
@method = method_from_description
|
30
|
+
@args = args_for_method(@method).unshift(key)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "is okay with positive ints" do
|
34
|
+
@args[@_arg_index] = 1
|
35
|
+
lambda { @redises.send(@method, *@args) }.should_not raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
it "is okay with negative ints" do
|
39
|
+
@args[@_arg_index] = -1
|
40
|
+
lambda { @redises.send(@method, *@args) }.should_not raise_error
|
41
|
+
end
|
42
|
+
|
43
|
+
it "is okay with positive floats" do
|
44
|
+
@args[@_arg_index] = 1.5
|
45
|
+
lambda { @redises.send(@method, *@args) }.should_not raise_error
|
46
|
+
end
|
47
|
+
|
48
|
+
it "is okay with negative floats" do
|
49
|
+
@args[@_arg_index] = 1.5
|
50
|
+
lambda { @redises.send(@method, *@args) }.should_not raise_error
|
51
|
+
end
|
52
|
+
|
53
|
+
it "rejects non-numbers" do
|
54
|
+
@args[@_arg_index] = 'foo'
|
55
|
+
lambda { @redises.send(@method, *@args) }.should raise_error(RuntimeError)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'transactions (multi/exec/discard)' do
|
4
|
+
before(:each) do
|
5
|
+
@redises.discard rescue nil
|
6
|
+
end
|
7
|
+
|
8
|
+
context "#multi" do
|
9
|
+
it "responds with 'OK'" do
|
10
|
+
@redises.multi.should == 'OK'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "forbids nesting" do
|
14
|
+
@redises.multi
|
15
|
+
lambda do
|
16
|
+
@redises.multi
|
17
|
+
end.should raise_error(RuntimeError)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "#discard" do
|
22
|
+
it "responds with 'OK' after #multi" do
|
23
|
+
@redises.multi
|
24
|
+
@redises.discard.should == 'OK'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "can't be run outside of #multi/#exec" do
|
28
|
+
lambda do
|
29
|
+
@redises.discard
|
30
|
+
end.should raise_error(RuntimeError)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "#exec" do
|
35
|
+
it "raises an error outside of #multi" do
|
36
|
+
lambda do
|
37
|
+
@redises.exec.should raise_error
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "saving up commands for later" do
|
43
|
+
before(:each) do
|
44
|
+
@redises.multi
|
45
|
+
@string = 'mock-redis-test:string'
|
46
|
+
@list = 'mock-redis-test:list'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "makes commands respond with 'QUEUED'" do
|
50
|
+
@redises.set(@string, 'string').should == 'QUEUED'
|
51
|
+
@redises.lpush(@list, 'list').should == 'QUEUED'
|
52
|
+
end
|
53
|
+
|
54
|
+
it "gives you the commands' responses when you call #exec" do
|
55
|
+
@redises.set(@string, 'string')
|
56
|
+
@redises.lpush(@list, 'list')
|
57
|
+
@redises.lpush(@list, 'list')
|
58
|
+
|
59
|
+
@redises.exec.should == ['OK', 1, 2]
|
60
|
+
end
|
61
|
+
|
62
|
+
it "does not raise exceptions, but rather puts them in #exec's response" do
|
63
|
+
@redises.set(@string, 'string')
|
64
|
+
@redises.lpush(@string, 'oops!')
|
65
|
+
@redises.lpush(@list, 'list')
|
66
|
+
|
67
|
+
responses = @redises.exec
|
68
|
+
responses[0].should == 'OK'
|
69
|
+
responses[1].should be_a(RuntimeError)
|
70
|
+
responses[2].should == 1
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
ADDED
@@ -0,0 +1,358 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mock_redis
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Samuel Merritt
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-14 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: redis
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 5
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 2
|
33
|
+
- 1
|
34
|
+
version: 2.2.1
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 6
|
49
|
+
- 0
|
50
|
+
version: 2.6.0
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: ZenTest
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
version: "0"
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
description: Instantiate one with `redis = MockRedis.new` and treat it like you would a normal Redis object. It supports all the usual Redis operations.
|
68
|
+
email:
|
69
|
+
- spam@andcheese.org
|
70
|
+
executables: []
|
71
|
+
|
72
|
+
extensions: []
|
73
|
+
|
74
|
+
extra_rdoc_files: []
|
75
|
+
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- .rspec
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/mock_redis.rb
|
84
|
+
- lib/mock_redis/assertions.rb
|
85
|
+
- lib/mock_redis/database.rb
|
86
|
+
- lib/mock_redis/exceptions.rb
|
87
|
+
- lib/mock_redis/expire_wrapper.rb
|
88
|
+
- lib/mock_redis/hash_methods.rb
|
89
|
+
- lib/mock_redis/list_methods.rb
|
90
|
+
- lib/mock_redis/multi_db_wrapper.rb
|
91
|
+
- lib/mock_redis/set_methods.rb
|
92
|
+
- lib/mock_redis/string_methods.rb
|
93
|
+
- lib/mock_redis/transaction_wrapper.rb
|
94
|
+
- lib/mock_redis/undef_redis_methods.rb
|
95
|
+
- lib/mock_redis/utility_methods.rb
|
96
|
+
- lib/mock_redis/version.rb
|
97
|
+
- lib/mock_redis/zset.rb
|
98
|
+
- lib/mock_redis/zset_methods.rb
|
99
|
+
- mock_redis.gemspec
|
100
|
+
- spec/cloning_spec.rb
|
101
|
+
- spec/commands/append_spec.rb
|
102
|
+
- spec/commands/auth_spec.rb
|
103
|
+
- spec/commands/bgrewriteaof_spec.rb
|
104
|
+
- spec/commands/bgsave_spec.rb
|
105
|
+
- spec/commands/blpop_spec.rb
|
106
|
+
- spec/commands/brpop_spec.rb
|
107
|
+
- spec/commands/brpoplpush_spec.rb
|
108
|
+
- spec/commands/dbsize_spec.rb
|
109
|
+
- spec/commands/decr_spec.rb
|
110
|
+
- spec/commands/decrby_spec.rb
|
111
|
+
- spec/commands/del_spec.rb
|
112
|
+
- spec/commands/echo_spec.rb
|
113
|
+
- spec/commands/exists_spec.rb
|
114
|
+
- spec/commands/expire_spec.rb
|
115
|
+
- spec/commands/expireat_spec.rb
|
116
|
+
- spec/commands/flushall_spec.rb
|
117
|
+
- spec/commands/flushdb_spec.rb
|
118
|
+
- spec/commands/get_spec.rb
|
119
|
+
- spec/commands/getbit_spec.rb
|
120
|
+
- spec/commands/getrange_spec.rb
|
121
|
+
- spec/commands/getset_spec.rb
|
122
|
+
- spec/commands/hdel_spec.rb
|
123
|
+
- spec/commands/hexists_spec.rb
|
124
|
+
- spec/commands/hget_spec.rb
|
125
|
+
- spec/commands/hgetall_spec.rb
|
126
|
+
- spec/commands/hincrby_spec.rb
|
127
|
+
- spec/commands/hkeys_spec.rb
|
128
|
+
- spec/commands/hlen_spec.rb
|
129
|
+
- spec/commands/hmget_spec.rb
|
130
|
+
- spec/commands/hmset_spec.rb
|
131
|
+
- spec/commands/hset_spec.rb
|
132
|
+
- spec/commands/hsetnx_spec.rb
|
133
|
+
- spec/commands/hvals_spec.rb
|
134
|
+
- spec/commands/incr_spec.rb
|
135
|
+
- spec/commands/incrby_spec.rb
|
136
|
+
- spec/commands/info_spec.rb
|
137
|
+
- spec/commands/keys_spec.rb
|
138
|
+
- spec/commands/lastsave_spec.rb
|
139
|
+
- spec/commands/lindex_spec.rb
|
140
|
+
- spec/commands/linsert_spec.rb
|
141
|
+
- spec/commands/llen_spec.rb
|
142
|
+
- spec/commands/lpop_spec.rb
|
143
|
+
- spec/commands/lpush_spec.rb
|
144
|
+
- spec/commands/lpushx_spec.rb
|
145
|
+
- spec/commands/lrange_spec.rb
|
146
|
+
- spec/commands/lrem_spec.rb
|
147
|
+
- spec/commands/lset_spec.rb
|
148
|
+
- spec/commands/ltrim_spec.rb
|
149
|
+
- spec/commands/mget_spec.rb
|
150
|
+
- spec/commands/mset_spec.rb
|
151
|
+
- spec/commands/msetnx_spec.rb
|
152
|
+
- spec/commands/persist_spec.rb
|
153
|
+
- spec/commands/ping_spec.rb
|
154
|
+
- spec/commands/quit_spec.rb
|
155
|
+
- spec/commands/randomkey_spec.rb
|
156
|
+
- spec/commands/rename_spec.rb
|
157
|
+
- spec/commands/renamenx_spec.rb
|
158
|
+
- spec/commands/rpop_spec.rb
|
159
|
+
- spec/commands/rpoplpush_spec.rb
|
160
|
+
- spec/commands/rpush_spec.rb
|
161
|
+
- spec/commands/rpushx_spec.rb
|
162
|
+
- spec/commands/sadd_spec.rb
|
163
|
+
- spec/commands/save_spec.rb
|
164
|
+
- spec/commands/scard_spec.rb
|
165
|
+
- spec/commands/sdiff_spec.rb
|
166
|
+
- spec/commands/sdiffstore_spec.rb
|
167
|
+
- spec/commands/select_spec.rb
|
168
|
+
- spec/commands/set_spec.rb
|
169
|
+
- spec/commands/setbit_spec.rb
|
170
|
+
- spec/commands/setex_spec.rb
|
171
|
+
- spec/commands/setnx_spec.rb
|
172
|
+
- spec/commands/setrange_spec.rb
|
173
|
+
- spec/commands/sinter_spec.rb
|
174
|
+
- spec/commands/sinterstore_spec.rb
|
175
|
+
- spec/commands/sismember_spec.rb
|
176
|
+
- spec/commands/smembers_spec.rb
|
177
|
+
- spec/commands/smove_spec.rb
|
178
|
+
- spec/commands/spop_spec.rb
|
179
|
+
- spec/commands/srandmember_spec.rb
|
180
|
+
- spec/commands/srem_spec.rb
|
181
|
+
- spec/commands/strlen_spec.rb
|
182
|
+
- spec/commands/sunion_spec.rb
|
183
|
+
- spec/commands/sunionstore_spec.rb
|
184
|
+
- spec/commands/ttl_spec.rb
|
185
|
+
- spec/commands/type_spec.rb
|
186
|
+
- spec/commands/unwatch_spec.rb
|
187
|
+
- spec/commands/watch_spec.rb
|
188
|
+
- spec/commands/zadd_spec.rb
|
189
|
+
- spec/commands/zcard_spec.rb
|
190
|
+
- spec/commands/zcount_spec.rb
|
191
|
+
- spec/commands/zincrby_spec.rb
|
192
|
+
- spec/commands/zinterstore_spec.rb
|
193
|
+
- spec/commands/zrange_spec.rb
|
194
|
+
- spec/commands/zrangebyscore_spec.rb
|
195
|
+
- spec/commands/zrank_spec.rb
|
196
|
+
- spec/commands/zrem_spec.rb
|
197
|
+
- spec/commands/zremrangebyrank_spec.rb
|
198
|
+
- spec/commands/zremrangebyscore_spec.rb
|
199
|
+
- spec/commands/zrevrange_spec.rb
|
200
|
+
- spec/commands/zrevrangebyscore_spec.rb
|
201
|
+
- spec/commands/zrevrank_spec.rb
|
202
|
+
- spec/commands/zscore_spec.rb
|
203
|
+
- spec/commands/zunionstore_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
205
|
+
- spec/support/redis_multiplexer.rb
|
206
|
+
- spec/support/shared_examples/only_operates_on_hashes.rb
|
207
|
+
- spec/support/shared_examples/only_operates_on_lists.rb
|
208
|
+
- spec/support/shared_examples/only_operates_on_sets.rb
|
209
|
+
- spec/support/shared_examples/only_operates_on_strings.rb
|
210
|
+
- spec/support/shared_examples/only_operates_on_zsets.rb
|
211
|
+
- spec/transactions_spec.rb
|
212
|
+
has_rdoc: true
|
213
|
+
homepage: https://github.com/smerritt/mock_redis
|
214
|
+
licenses: []
|
215
|
+
|
216
|
+
post_install_message:
|
217
|
+
rdoc_options: []
|
218
|
+
|
219
|
+
require_paths:
|
220
|
+
- lib
|
221
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
222
|
+
none: false
|
223
|
+
requirements:
|
224
|
+
- - ">="
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
hash: 3
|
227
|
+
segments:
|
228
|
+
- 0
|
229
|
+
version: "0"
|
230
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
231
|
+
none: false
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
hash: 3
|
236
|
+
segments:
|
237
|
+
- 0
|
238
|
+
version: "0"
|
239
|
+
requirements: []
|
240
|
+
|
241
|
+
rubyforge_project:
|
242
|
+
rubygems_version: 1.3.7
|
243
|
+
signing_key:
|
244
|
+
specification_version: 3
|
245
|
+
summary: Redis mock that just lives in memory; useful for testing.
|
246
|
+
test_files:
|
247
|
+
- spec/cloning_spec.rb
|
248
|
+
- spec/commands/append_spec.rb
|
249
|
+
- spec/commands/auth_spec.rb
|
250
|
+
- spec/commands/bgrewriteaof_spec.rb
|
251
|
+
- spec/commands/bgsave_spec.rb
|
252
|
+
- spec/commands/blpop_spec.rb
|
253
|
+
- spec/commands/brpop_spec.rb
|
254
|
+
- spec/commands/brpoplpush_spec.rb
|
255
|
+
- spec/commands/dbsize_spec.rb
|
256
|
+
- spec/commands/decr_spec.rb
|
257
|
+
- spec/commands/decrby_spec.rb
|
258
|
+
- spec/commands/del_spec.rb
|
259
|
+
- spec/commands/echo_spec.rb
|
260
|
+
- spec/commands/exists_spec.rb
|
261
|
+
- spec/commands/expire_spec.rb
|
262
|
+
- spec/commands/expireat_spec.rb
|
263
|
+
- spec/commands/flushall_spec.rb
|
264
|
+
- spec/commands/flushdb_spec.rb
|
265
|
+
- spec/commands/get_spec.rb
|
266
|
+
- spec/commands/getbit_spec.rb
|
267
|
+
- spec/commands/getrange_spec.rb
|
268
|
+
- spec/commands/getset_spec.rb
|
269
|
+
- spec/commands/hdel_spec.rb
|
270
|
+
- spec/commands/hexists_spec.rb
|
271
|
+
- spec/commands/hget_spec.rb
|
272
|
+
- spec/commands/hgetall_spec.rb
|
273
|
+
- spec/commands/hincrby_spec.rb
|
274
|
+
- spec/commands/hkeys_spec.rb
|
275
|
+
- spec/commands/hlen_spec.rb
|
276
|
+
- spec/commands/hmget_spec.rb
|
277
|
+
- spec/commands/hmset_spec.rb
|
278
|
+
- spec/commands/hset_spec.rb
|
279
|
+
- spec/commands/hsetnx_spec.rb
|
280
|
+
- spec/commands/hvals_spec.rb
|
281
|
+
- spec/commands/incr_spec.rb
|
282
|
+
- spec/commands/incrby_spec.rb
|
283
|
+
- spec/commands/info_spec.rb
|
284
|
+
- spec/commands/keys_spec.rb
|
285
|
+
- spec/commands/lastsave_spec.rb
|
286
|
+
- spec/commands/lindex_spec.rb
|
287
|
+
- spec/commands/linsert_spec.rb
|
288
|
+
- spec/commands/llen_spec.rb
|
289
|
+
- spec/commands/lpop_spec.rb
|
290
|
+
- spec/commands/lpush_spec.rb
|
291
|
+
- spec/commands/lpushx_spec.rb
|
292
|
+
- spec/commands/lrange_spec.rb
|
293
|
+
- spec/commands/lrem_spec.rb
|
294
|
+
- spec/commands/lset_spec.rb
|
295
|
+
- spec/commands/ltrim_spec.rb
|
296
|
+
- spec/commands/mget_spec.rb
|
297
|
+
- spec/commands/mset_spec.rb
|
298
|
+
- spec/commands/msetnx_spec.rb
|
299
|
+
- spec/commands/persist_spec.rb
|
300
|
+
- spec/commands/ping_spec.rb
|
301
|
+
- spec/commands/quit_spec.rb
|
302
|
+
- spec/commands/randomkey_spec.rb
|
303
|
+
- spec/commands/rename_spec.rb
|
304
|
+
- spec/commands/renamenx_spec.rb
|
305
|
+
- spec/commands/rpop_spec.rb
|
306
|
+
- spec/commands/rpoplpush_spec.rb
|
307
|
+
- spec/commands/rpush_spec.rb
|
308
|
+
- spec/commands/rpushx_spec.rb
|
309
|
+
- spec/commands/sadd_spec.rb
|
310
|
+
- spec/commands/save_spec.rb
|
311
|
+
- spec/commands/scard_spec.rb
|
312
|
+
- spec/commands/sdiff_spec.rb
|
313
|
+
- spec/commands/sdiffstore_spec.rb
|
314
|
+
- spec/commands/select_spec.rb
|
315
|
+
- spec/commands/set_spec.rb
|
316
|
+
- spec/commands/setbit_spec.rb
|
317
|
+
- spec/commands/setex_spec.rb
|
318
|
+
- spec/commands/setnx_spec.rb
|
319
|
+
- spec/commands/setrange_spec.rb
|
320
|
+
- spec/commands/sinter_spec.rb
|
321
|
+
- spec/commands/sinterstore_spec.rb
|
322
|
+
- spec/commands/sismember_spec.rb
|
323
|
+
- spec/commands/smembers_spec.rb
|
324
|
+
- spec/commands/smove_spec.rb
|
325
|
+
- spec/commands/spop_spec.rb
|
326
|
+
- spec/commands/srandmember_spec.rb
|
327
|
+
- spec/commands/srem_spec.rb
|
328
|
+
- spec/commands/strlen_spec.rb
|
329
|
+
- spec/commands/sunion_spec.rb
|
330
|
+
- spec/commands/sunionstore_spec.rb
|
331
|
+
- spec/commands/ttl_spec.rb
|
332
|
+
- spec/commands/type_spec.rb
|
333
|
+
- spec/commands/unwatch_spec.rb
|
334
|
+
- spec/commands/watch_spec.rb
|
335
|
+
- spec/commands/zadd_spec.rb
|
336
|
+
- spec/commands/zcard_spec.rb
|
337
|
+
- spec/commands/zcount_spec.rb
|
338
|
+
- spec/commands/zincrby_spec.rb
|
339
|
+
- spec/commands/zinterstore_spec.rb
|
340
|
+
- spec/commands/zrange_spec.rb
|
341
|
+
- spec/commands/zrangebyscore_spec.rb
|
342
|
+
- spec/commands/zrank_spec.rb
|
343
|
+
- spec/commands/zrem_spec.rb
|
344
|
+
- spec/commands/zremrangebyrank_spec.rb
|
345
|
+
- spec/commands/zremrangebyscore_spec.rb
|
346
|
+
- spec/commands/zrevrange_spec.rb
|
347
|
+
- spec/commands/zrevrangebyscore_spec.rb
|
348
|
+
- spec/commands/zrevrank_spec.rb
|
349
|
+
- spec/commands/zscore_spec.rb
|
350
|
+
- spec/commands/zunionstore_spec.rb
|
351
|
+
- spec/spec_helper.rb
|
352
|
+
- spec/support/redis_multiplexer.rb
|
353
|
+
- spec/support/shared_examples/only_operates_on_hashes.rb
|
354
|
+
- spec/support/shared_examples/only_operates_on_lists.rb
|
355
|
+
- spec/support/shared_examples/only_operates_on_sets.rb
|
356
|
+
- spec/support/shared_examples/only_operates_on_strings.rb
|
357
|
+
- spec/support/shared_examples/only_operates_on_zsets.rb
|
358
|
+
- spec/transactions_spec.rb
|