mock_redis 0.5.4 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/lint.yml +31 -0
- data/.github/workflows/tests.yml +63 -0
- data/.gitignore +1 -1
- data/.overcommit.yml +21 -0
- data/.rspec +1 -1
- data/.rubocop.yml +148 -0
- data/.rubocop_todo.yml +35 -0
- data/.simplecov +4 -0
- data/CHANGELOG.md +278 -0
- data/Gemfile +9 -5
- data/LICENSE.md +21 -0
- data/README.md +52 -16
- data/Rakefile +0 -8
- data/lib/mock_redis/assertions.rb +0 -1
- data/lib/mock_redis/connection_method.rb +13 -0
- data/lib/mock_redis/database.rb +193 -257
- data/lib/mock_redis/expire_wrapper.rb +2 -2
- data/lib/mock_redis/future.rb +23 -0
- data/lib/mock_redis/geospatial_methods.rb +240 -0
- data/lib/mock_redis/hash_methods.rb +83 -24
- data/lib/mock_redis/indifferent_hash.rb +11 -0
- data/lib/mock_redis/info_method.rb +160 -0
- data/lib/mock_redis/list_methods.rb +34 -19
- data/lib/mock_redis/multi_db_wrapper.rb +8 -7
- data/lib/mock_redis/pipelined_wrapper.rb +42 -16
- data/lib/mock_redis/set_methods.rb +62 -19
- data/lib/mock_redis/sort_method.rb +81 -0
- data/lib/mock_redis/stream/id.rb +58 -0
- data/lib/mock_redis/stream.rb +88 -0
- data/lib/mock_redis/stream_methods.rb +102 -0
- data/lib/mock_redis/string_methods.rb +235 -42
- data/lib/mock_redis/transaction_wrapper.rb +62 -28
- data/lib/mock_redis/utility_methods.rb +62 -11
- data/lib/mock_redis/version.rb +4 -1
- data/lib/mock_redis/zset.rb +24 -29
- data/lib/mock_redis/zset_methods.rb +187 -59
- data/lib/mock_redis.rb +77 -27
- data/mock_redis.gemspec +23 -15
- data/spec/client_spec.rb +29 -0
- data/spec/cloning_spec.rb +17 -18
- data/spec/commands/append_spec.rb +4 -4
- data/spec/commands/auth_spec.rb +1 -1
- data/spec/commands/bgrewriteaof_spec.rb +2 -2
- data/spec/commands/bgsave_spec.rb +2 -2
- data/spec/commands/bitcount_spec.rb +25 -0
- data/spec/commands/bitfield_spec.rb +169 -0
- data/spec/commands/blpop_spec.rb +19 -21
- data/spec/commands/brpop_spec.rb +25 -20
- data/spec/commands/brpoplpush_spec.rb +16 -17
- data/spec/commands/connected_spec.rb +7 -0
- data/spec/commands/connection_spec.rb +15 -0
- data/spec/commands/dbsize_spec.rb +3 -3
- data/spec/commands/decr_spec.rb +8 -8
- data/spec/commands/decrby_spec.rb +8 -8
- data/spec/commands/del_spec.rb +35 -3
- data/spec/commands/disconnect_spec.rb +7 -0
- data/spec/commands/dump_spec.rb +19 -0
- data/spec/commands/echo_spec.rb +4 -4
- data/spec/commands/eval_spec.rb +7 -0
- data/spec/commands/evalsha_spec.rb +10 -0
- data/spec/commands/exists_spec.rb +36 -7
- data/spec/commands/expire_spec.rb +48 -20
- data/spec/commands/expireat_spec.rb +12 -13
- data/spec/commands/flushall_spec.rb +5 -5
- data/spec/commands/flushdb_spec.rb +5 -5
- data/spec/commands/future_spec.rb +30 -0
- data/spec/commands/geoadd_spec.rb +58 -0
- data/spec/commands/geodist_spec.rb +118 -0
- data/spec/commands/geohash_spec.rb +52 -0
- data/spec/commands/geopos_spec.rb +55 -0
- data/spec/commands/get_spec.rb +14 -6
- data/spec/commands/getbit_spec.rb +7 -7
- data/spec/commands/getrange_spec.rb +9 -9
- data/spec/commands/getset_spec.rb +7 -7
- data/spec/commands/hdel_spec.rb +41 -11
- data/spec/commands/hexists_spec.rb +11 -11
- data/spec/commands/hget_spec.rb +7 -7
- data/spec/commands/hgetall_spec.rb +15 -5
- data/spec/commands/hincrby_spec.rb +16 -16
- data/spec/commands/hincrbyfloat_spec.rb +58 -0
- data/spec/commands/hkeys_spec.rb +5 -5
- data/spec/commands/hlen_spec.rb +5 -5
- data/spec/commands/hmget_spec.rb +19 -9
- data/spec/commands/hmset_spec.rb +38 -12
- data/spec/commands/hscan_each_spec.rb +48 -0
- data/spec/commands/hscan_spec.rb +27 -0
- data/spec/commands/hset_spec.rb +26 -12
- data/spec/commands/hsetnx_spec.rb +16 -16
- data/spec/commands/hvals_spec.rb +5 -5
- data/spec/commands/incr_spec.rb +8 -8
- data/spec/commands/incrby_spec.rb +13 -13
- data/spec/commands/incrbyfloat_spec.rb +13 -13
- data/spec/commands/info_spec.rb +54 -5
- data/spec/commands/keys_spec.rb +83 -31
- data/spec/commands/lastsave_spec.rb +2 -2
- data/spec/commands/lindex_spec.rb +20 -10
- data/spec/commands/linsert_spec.rb +14 -14
- data/spec/commands/llen_spec.rb +4 -4
- data/spec/commands/lpop_spec.rb +6 -6
- data/spec/commands/lpush_spec.rb +21 -15
- data/spec/commands/lpushx_spec.rb +24 -11
- data/spec/commands/lrange_spec.rb +24 -8
- data/spec/commands/lrem_spec.rb +16 -16
- data/spec/commands/lset_spec.rb +17 -12
- data/spec/commands/ltrim_spec.rb +17 -7
- data/spec/commands/mapped_hmget_spec.rb +13 -9
- data/spec/commands/mapped_hmset_spec.rb +12 -12
- data/spec/commands/mapped_mget_spec.rb +22 -0
- data/spec/commands/mapped_mset_spec.rb +19 -0
- data/spec/commands/mapped_msetnx_spec.rb +26 -0
- data/spec/commands/mget_spec.rb +48 -17
- data/spec/commands/move_spec.rb +37 -37
- data/spec/commands/mset_spec.rb +20 -6
- data/spec/commands/msetnx_spec.rb +14 -14
- data/spec/commands/persist_spec.rb +15 -16
- data/spec/commands/pexpire_spec.rb +86 -0
- data/spec/commands/pexpireat_spec.rb +48 -0
- data/spec/commands/ping_spec.rb +6 -2
- data/spec/commands/pipelined_spec.rb +98 -7
- data/spec/commands/pttl_spec.rb +41 -0
- data/spec/commands/randomkey_spec.rb +3 -3
- data/spec/commands/rename_spec.rb +16 -12
- data/spec/commands/renamenx_spec.rb +13 -15
- data/spec/commands/restore_spec.rb +47 -0
- data/spec/commands/rpop_spec.rb +6 -6
- data/spec/commands/rpoplpush_spec.rb +13 -8
- data/spec/commands/rpush_spec.rb +21 -15
- data/spec/commands/rpushx_spec.rb +24 -11
- data/spec/commands/sadd_spec.rb +14 -10
- data/spec/commands/scan_each_spec.rb +39 -0
- data/spec/commands/scan_spec.rb +64 -0
- data/spec/commands/scard_spec.rb +3 -3
- data/spec/commands/script_spec.rb +9 -0
- data/spec/commands/sdiff_spec.rb +13 -13
- data/spec/commands/sdiffstore_spec.rb +13 -13
- data/spec/commands/select_spec.rb +13 -5
- data/spec/commands/set_spec.rb +112 -0
- data/spec/commands/setbit_spec.rb +25 -16
- data/spec/commands/setex_spec.rb +20 -4
- data/spec/commands/setnx_spec.rb +6 -6
- data/spec/commands/setrange_spec.rb +12 -12
- data/spec/commands/sinter_spec.rb +11 -13
- data/spec/commands/sinterstore_spec.rb +12 -12
- data/spec/commands/sismember_spec.rb +10 -10
- data/spec/commands/smembers_spec.rb +15 -5
- data/spec/commands/smove_spec.rb +13 -13
- data/spec/commands/sort_list_spec.rb +21 -0
- data/spec/commands/sort_set_spec.rb +21 -0
- data/spec/commands/sort_zset_spec.rb +21 -0
- data/spec/commands/spop_spec.rb +19 -4
- data/spec/commands/srandmember_spec.rb +28 -4
- data/spec/commands/srem_spec.rb +17 -12
- data/spec/commands/sscan_each_spec.rb +48 -0
- data/spec/commands/sscan_spec.rb +39 -0
- data/spec/commands/strlen_spec.rb +4 -5
- data/spec/commands/sunion_spec.rb +13 -11
- data/spec/commands/sunionstore_spec.rb +12 -12
- data/spec/commands/ttl_spec.rb +11 -6
- data/spec/commands/type_spec.rb +1 -1
- data/spec/commands/watch_spec.rb +9 -4
- data/spec/commands/xadd_spec.rb +122 -0
- data/spec/commands/xlen_spec.rb +22 -0
- data/spec/commands/xrange_spec.rb +164 -0
- data/spec/commands/xread_spec.rb +66 -0
- data/spec/commands/xrevrange_spec.rb +130 -0
- data/spec/commands/xtrim_spec.rb +36 -0
- data/spec/commands/zadd_spec.rb +100 -11
- data/spec/commands/zcard_spec.rb +4 -4
- data/spec/commands/zcount_spec.rb +18 -10
- data/spec/commands/zincrby_spec.rb +6 -6
- data/spec/commands/zinterstore_spec.rb +54 -20
- data/spec/commands/zpopmax_spec.rb +60 -0
- data/spec/commands/zpopmin_spec.rb +60 -0
- data/spec/commands/zrange_spec.rb +54 -13
- data/spec/commands/zrangebyscore_spec.rb +42 -27
- data/spec/commands/zrank_spec.rb +4 -4
- data/spec/commands/zrem_spec.rb +18 -12
- data/spec/commands/zremrangebyrank_spec.rb +5 -5
- data/spec/commands/zremrangebyscore_spec.rb +12 -5
- data/spec/commands/zrevrange_spec.rb +35 -10
- data/spec/commands/zrevrangebyscore_spec.rb +26 -15
- data/spec/commands/zrevrank_spec.rb +4 -4
- data/spec/commands/zscan_each_spec.rb +48 -0
- data/spec/commands/zscan_spec.rb +26 -0
- data/spec/commands/zscore_spec.rb +7 -7
- data/spec/commands/zunionstore_spec.rb +54 -21
- data/spec/mock_redis_spec.rb +61 -0
- data/spec/spec_helper.rb +35 -8
- data/spec/support/redis_multiplexer.rb +62 -37
- data/spec/support/shared_examples/does_not_cleanup_empty_strings.rb +14 -0
- data/spec/support/shared_examples/only_operates_on_hashes.rb +5 -3
- data/spec/support/shared_examples/only_operates_on_lists.rb +5 -3
- data/spec/support/shared_examples/only_operates_on_sets.rb +5 -3
- data/spec/support/shared_examples/only_operates_on_strings.rb +4 -4
- data/spec/support/shared_examples/only_operates_on_zsets.rb +18 -16
- data/spec/support/shared_examples/sorts_enumerables.rb +56 -0
- data/spec/transactions_spec.rb +79 -29
- metadata +162 -42
- data/LICENSE +0 -19
- data/spec/commands/hash_operator_spec.rb +0 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2870385004370b0471f3cf495184d8e11f138e0cb13b9bef9bd43ed7ce2b35ff
|
4
|
+
data.tar.gz: 75475cf000d2075ad2565440aea2521fa1034248726b5070ff149d9518c00c3a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6e6f75b19c46fd81ef553dfe1af1f32b2dceb13e4b660835cd58b1760fa8445c09c2ef26bf67cf64adcf87e196de24798333350e0a07ca0fac39939e296659e4
|
7
|
+
data.tar.gz: 77c2c5fc3f67f654d402161541b1527c6779859a0ec6e61a5fb6048b7abfcab50728ba2c25617a2adf303b22a23e662a8f2ee7236085db02682e0e8ca690438a
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: Lint
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [main]
|
5
|
+
pull_request:
|
6
|
+
branches: [main]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
overcommit:
|
10
|
+
timeout-minutes: 10
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1.97.0
|
18
|
+
with:
|
19
|
+
ruby-version: 2.7
|
20
|
+
|
21
|
+
- name: Install dependencies
|
22
|
+
run: bundle install
|
23
|
+
|
24
|
+
- name: Prepare environment
|
25
|
+
run: |
|
26
|
+
git config --local user.email "gh-actions@example.com"
|
27
|
+
git config --local user.name "GitHub Actions"
|
28
|
+
bundle exec overcommit --sign
|
29
|
+
|
30
|
+
- name: Run pre-commit checks
|
31
|
+
run: bundle exec overcommit --run
|
@@ -0,0 +1,63 @@
|
|
1
|
+
name: Tests
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [main]
|
5
|
+
pull_request:
|
6
|
+
branches: [main]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
rspec:
|
10
|
+
timeout-minutes: 10
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version:
|
16
|
+
- '2.6'
|
17
|
+
- '2.7'
|
18
|
+
- '3.0'
|
19
|
+
redis-version:
|
20
|
+
- '6.2'
|
21
|
+
|
22
|
+
services:
|
23
|
+
redis:
|
24
|
+
image: redis:${{ matrix.redis-version }}-alpine
|
25
|
+
options: >-
|
26
|
+
--health-cmd "redis-cli ping"
|
27
|
+
--health-interval 10s
|
28
|
+
--health-timeout 5s
|
29
|
+
--health-retries 5
|
30
|
+
ports:
|
31
|
+
- 6379:6379
|
32
|
+
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v2
|
35
|
+
|
36
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
37
|
+
uses: ruby/setup-ruby@v1.97.0
|
38
|
+
with:
|
39
|
+
ruby-version: ${{ matrix.ruby-version }}
|
40
|
+
|
41
|
+
- name: Install dependencies
|
42
|
+
run: bundle install
|
43
|
+
|
44
|
+
- name: Run tests
|
45
|
+
run: bundle exec rspec
|
46
|
+
|
47
|
+
- name: Code coverage reporting
|
48
|
+
uses: coverallsapp/github-action@master
|
49
|
+
with:
|
50
|
+
github-token: ${{ secrets.github_token }}
|
51
|
+
flag-name: ruby${{ matrix.ruby-version }}-${{ matrix.redis-version }}
|
52
|
+
parallel: true
|
53
|
+
|
54
|
+
finish:
|
55
|
+
needs: rspec
|
56
|
+
runs-on: ubuntu-latest
|
57
|
+
|
58
|
+
steps:
|
59
|
+
- name: Finalize code coverage report
|
60
|
+
uses: coverallsapp/github-action@master
|
61
|
+
with:
|
62
|
+
github-token: ${{ secrets.github_token }}
|
63
|
+
parallel-finished: true
|
data/.gitignore
CHANGED
data/.overcommit.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
gemfile: Gemfile
|
2
|
+
|
3
|
+
PreCommit:
|
4
|
+
BundleCheck:
|
5
|
+
enabled: true
|
6
|
+
|
7
|
+
ExecutePermissions:
|
8
|
+
enabled: true
|
9
|
+
|
10
|
+
HardTabs:
|
11
|
+
enabled: true
|
12
|
+
|
13
|
+
RuboCop:
|
14
|
+
enabled: true
|
15
|
+
command: ['bundle', 'exec', 'rubocop']
|
16
|
+
|
17
|
+
TrailingWhitespace:
|
18
|
+
enabled: true
|
19
|
+
|
20
|
+
YamlSyntax:
|
21
|
+
enabled: true
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.4
|
5
|
+
|
6
|
+
Layout/ArgumentAlignment:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
Layout/ParameterAlignment:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Layout/DotPosition:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/EmptyLineAfterGuardClause:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Layout/LineLength:
|
19
|
+
Max: 100
|
20
|
+
|
21
|
+
Layout/SpaceAroundMethodCallOperator:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Lint/AssignmentInCondition:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Lint/RaiseException:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
Lint/StructNewOverride:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
# We use this a lot in specs where it's perfectly valid
|
34
|
+
Lint/Void:
|
35
|
+
Exclude:
|
36
|
+
- spec/**/*
|
37
|
+
|
38
|
+
Metrics/AbcSize:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Metrics/BlockLength:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Metrics/CyclomaticComplexity:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Metrics/ClassLength:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Metrics/MethodLength:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Metrics/ModuleLength:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Metrics/PerceivedComplexity:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
# This hides the has-a versus is-a relationship indicated by the method name
|
60
|
+
Naming/PredicateName:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/Documentation:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/DoubleNegation:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/ExponentialNotation:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/HashEachMethods:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Style/HashTransformKeys:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Style/HashTransformValues:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
# We have too much code that relies on modifying strings
|
82
|
+
Style/FrozenStringLiteralComment:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Style/GuardClause:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
Style/HashSyntax:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Style/IfUnlessModifier:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Style/Lambda:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
# TODO: Address these at some point
|
98
|
+
Style/MethodMissingSuper:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
Style/MissingRespondToMissing:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Style/MultilineBlockChain:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/NumericPredicate:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
# Prefer curly braces except for %i/%w/%W, since those return arrays.
|
111
|
+
Style/PercentLiteralDelimiters:
|
112
|
+
PreferredDelimiters:
|
113
|
+
'%': '{}'
|
114
|
+
'%i': '[]'
|
115
|
+
'%q': '{}'
|
116
|
+
'%Q': '{}'
|
117
|
+
'%r': '{}'
|
118
|
+
'%s': '()'
|
119
|
+
'%w': '[]'
|
120
|
+
'%W': '[]'
|
121
|
+
'%x': '{}'
|
122
|
+
|
123
|
+
Style/PerlBackrefs:
|
124
|
+
Enabled: false
|
125
|
+
|
126
|
+
Style/RescueModifier:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
Style/SignalException:
|
130
|
+
Enabled: false
|
131
|
+
|
132
|
+
Style/SingleLineBlockParams:
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Style/SymbolArray:
|
136
|
+
Enabled: false
|
137
|
+
|
138
|
+
Style/TrailingCommaInArguments:
|
139
|
+
Enabled: false
|
140
|
+
|
141
|
+
Style/TrailingCommaInArrayLiteral:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
Style/TrailingCommaInHashLiteral:
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
Style/WhenThen:
|
148
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2018-08-03 11:15:53 -0700 using RuboCop version 0.58.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 17
|
10
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
11
|
+
# AllowedNames: io, id, to, by, on, in, at, ip
|
12
|
+
Naming/MethodParameterName:
|
13
|
+
Exclude:
|
14
|
+
- 'lib/mock_redis/database.rb'
|
15
|
+
- 'lib/mock_redis/expire_wrapper.rb'
|
16
|
+
- 'lib/mock_redis/geospatial_methods.rb'
|
17
|
+
- 'lib/mock_redis/multi_db_wrapper.rb'
|
18
|
+
- 'lib/mock_redis/pipelined_wrapper.rb'
|
19
|
+
- 'lib/mock_redis/string_methods.rb'
|
20
|
+
- 'lib/mock_redis/transaction_wrapper.rb'
|
21
|
+
- 'lib/mock_redis/utility_methods.rb'
|
22
|
+
- 'lib/mock_redis/zset_methods.rb'
|
23
|
+
- 'spec/support/redis_multiplexer.rb'
|
24
|
+
|
25
|
+
# Offense count: 2
|
26
|
+
# Configuration parameters: EnforcedStyle.
|
27
|
+
# SupportedStyles: inline, group
|
28
|
+
Style/AccessModifierDeclarations:
|
29
|
+
Exclude:
|
30
|
+
- 'lib/mock_redis/zset_methods.rb'
|
31
|
+
|
32
|
+
# Offense count: 1
|
33
|
+
Style/DateTime:
|
34
|
+
Exclude:
|
35
|
+
- 'spec/commands/zremrangebyscore_spec.rb'
|
data/.simplecov
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,281 @@
|
|
1
|
+
# MockRedis Changelog
|
2
|
+
|
3
|
+
### 0.31.0
|
4
|
+
|
5
|
+
* Allow `ping` to take argument
|
6
|
+
* Raise `CommandError` on `hmget` with empty list of fields
|
7
|
+
|
8
|
+
### 0.30.0
|
9
|
+
|
10
|
+
* Drop support for Ruby 2.4 and Ruby 2.5 since they are EOL
|
11
|
+
* Fix `expire` to to raise error on invalid integer
|
12
|
+
|
13
|
+
### 0.29.0
|
14
|
+
|
15
|
+
* Add support for `logger` option ([#211](https://github.com/sds/mock_redis/pull/211))
|
16
|
+
* Fix `zadd` to not perform conditional type conversion ([#214](https://github.com/sds/mock_redis/pull/214))
|
17
|
+
* Fix `hdel` to raise error when called with empty array ([#215](https://github.com/sds/mock_redis/pull/215))
|
18
|
+
|
19
|
+
### 0.28.0
|
20
|
+
|
21
|
+
* Fix `hmset` exception ([#206](https://github.com/sds/mock_redis/pull/206))
|
22
|
+
* Fix `hmset` to accept hashes in addition to key/value pairs ([#208](https://github.com/sds/mock_redis/pull/208))
|
23
|
+
* Fix stream ID regex to support `(` ([#209](https://github.com/sds/mock_redis/pull/209))
|
24
|
+
* Allow `mget` to accept a block ([#210](https://github.com/sds/mock_redis/pull/210))
|
25
|
+
|
26
|
+
### 0.27.3
|
27
|
+
|
28
|
+
* Ensure `ruby2_keywords` dependency is `require`d at runtime
|
29
|
+
|
30
|
+
### 0.27.2
|
31
|
+
|
32
|
+
* Switch `ruby2_keywords` gem from development dependency to runtime dependency
|
33
|
+
|
34
|
+
### 0.27.1
|
35
|
+
|
36
|
+
* Fix missing `ruby2_keywords` gem
|
37
|
+
* Allow passing string `offset` to `getbit` ([#203](https://github.com/sds/mock_redis/pull/203))
|
38
|
+
|
39
|
+
### 0.27.0
|
40
|
+
|
41
|
+
* Fix handling of keyword arguments on Ruby 3 ([#199](https://github.com/sds/mock_redis/pull/199))
|
42
|
+
* Allow passing string `offset` to `setbit` ([#200](https://github.com/sds/mock_redis/pull/200))
|
43
|
+
* Add `connection` method ([#201](https://github.com/sds/mock_redis/pull/201))
|
44
|
+
|
45
|
+
### 0.26.0
|
46
|
+
|
47
|
+
* Add block and count support to `xread` ([#194](https://github.com/sds/mock_redis/pull/194))
|
48
|
+
|
49
|
+
### 0.25.0
|
50
|
+
|
51
|
+
* Add support for `xread` command ([#190](https://github.com/sds/mock_redis/pull/190))
|
52
|
+
* Fix `mget` to raise error when passing empty array ([#191](https://github.com/sds/mock_redis/pull/191))
|
53
|
+
* Fix `xadd` when `maxlen` is zero ([#192](https://github.com/sds/mock_redis/pull/192))
|
54
|
+
|
55
|
+
### 0.24.0
|
56
|
+
|
57
|
+
* Fix handling of blocks within `multi` blocks ([#185](https://github.com/sds/mock_redis/pull/185))
|
58
|
+
* Fix handling of multiple consecutive `?` characters in key pattern matching ([#186](https://github.com/sds/mock_redis/pull/186))
|
59
|
+
* Change `exists` to return an integer and add `exists?` ([#188](https://github.com/sds/mock_redis/pull/188))
|
60
|
+
|
61
|
+
### 0.23.0
|
62
|
+
|
63
|
+
* Raise error when `setex` called with negative timeout ([#174](https://github.com/sds/mock_redis/pull/174))
|
64
|
+
* Add support for `dump`/`restore` between MockRedis instances ([#176](https://github.com/sds/mock_redis/pull/176))
|
65
|
+
* Fix warnings for ZSET methods on Ruby 2.7 ([#177](https://github.com/sds/mock_redis/pull/177))
|
66
|
+
* Add support for returning time in pipelines ([#179](https://github.com/sds/mock_redis/pull/179))
|
67
|
+
* Fix SET methods to correct set milliseconds with `px` ([#180](https://github.com/sds/mock_redis/pull/180))
|
68
|
+
* Add support for unsorted sets within `zinterstore`/`zunionstore`([#182](https://github.com/sds/mock_redis/pull/182))
|
69
|
+
|
70
|
+
### 0.22.0
|
71
|
+
|
72
|
+
* Gracefully handle cursors larger than the collection size in scan commands ([#171](https://github.com/sds/mock_redis/pull/171))
|
73
|
+
* Add `zpopmin` and `zpopmax` commands ([#172](https://github.com/sds/mock_redis/pull/172))
|
74
|
+
* Fix `hmset` to support array arguments ([#173](https://github.com/sds/mock_redis/pull/173))
|
75
|
+
* Fix `hmset` to always treat keys as strings ([#173](https://github.com/sds/mock_redis/pull/173))
|
76
|
+
* Remove unnecessary dependency on `rake` gem
|
77
|
+
|
78
|
+
### 0.21.0
|
79
|
+
|
80
|
+
* Fix behavior of `time` to return array of two integers ([#161](https://github.com/sds/mock_redis/pull/161))
|
81
|
+
* Add support for `close` and `disconnect!` ([#163](https://github.com/sds/mock_redis/pull/163))
|
82
|
+
* Fix `set` to properly handle (and ignore) other options ([#164](https://github.com/sds/mock_redis/pull/163))
|
83
|
+
* Fix `srem` to allow array of integers as argument ([#166](https://github.com/sds/mock_redis/pull/166))
|
84
|
+
* Fix `hdel` to allow array as argument ([#168](https://github.com/sds/mock_redis/pull/168))
|
85
|
+
|
86
|
+
### 0.20.0
|
87
|
+
|
88
|
+
* Add support for `count` parameter of `spop`
|
89
|
+
* Fix `mget` and `mset` to accept array as parameters
|
90
|
+
* Fix pipelined array replies
|
91
|
+
* Fix nested pipelining
|
92
|
+
* Allow nested multi
|
93
|
+
* Require Redis gem 4.0.1 or newer
|
94
|
+
* Add support for stream commands on Redis 5
|
95
|
+
* Keep empty strings on type mismatch
|
96
|
+
* Improve performance of `set_expiration`
|
97
|
+
* Fix `watch` to allow multiple keys
|
98
|
+
* Add `unlink` alias for `del`
|
99
|
+
* Drop support for Ruby 2.3 or older
|
100
|
+
|
101
|
+
### 0.19.0
|
102
|
+
|
103
|
+
* Require Ruby 2.2+
|
104
|
+
* Add support for `bitfield` command
|
105
|
+
* Add support for `geoadd`, `geopos`, `geohash`, and `geodist` commands
|
106
|
+
* Fix multi-nested pipeline not releasing lock issue
|
107
|
+
|
108
|
+
### 0.18.0
|
109
|
+
|
110
|
+
* Fix `hset` return value to return false when the field exists in the hash
|
111
|
+
* Fix message on exception raised from hincrbyfloat to match Redis 4
|
112
|
+
* Fix `lpushx`/`rpushx` to correctly accept an array as the value
|
113
|
+
* Fix rename to allow `rename(k1, k1)`
|
114
|
+
|
115
|
+
### 0.17.3
|
116
|
+
|
117
|
+
* Fix `zrange` behavior with negative stop argument
|
118
|
+
|
119
|
+
### 0.17.2
|
120
|
+
|
121
|
+
* Allow negative out-of-bounds start and stop in `zrange`
|
122
|
+
|
123
|
+
### 0.17.1
|
124
|
+
|
125
|
+
* Flatten args list passed to `hmset`
|
126
|
+
* Fix `pipelined` calls within `multi` blocks
|
127
|
+
|
128
|
+
### 0.17.0
|
129
|
+
|
130
|
+
* Upgrade minimum `redis` gem version to 3.3.0+
|
131
|
+
* Add support for XX, NX and INCR parameters of `ZADD`
|
132
|
+
* Drop support for Ruby 1.9.3/JRuby 1.7.x
|
133
|
+
* Fix ZREM to raise error when argument is an empty array
|
134
|
+
|
135
|
+
### 0.16.1
|
136
|
+
|
137
|
+
* Relax `rake` gem dependency to allow 11.x.x versions
|
138
|
+
|
139
|
+
### 0.16.0
|
140
|
+
|
141
|
+
* Add stub implementations for `script`/`eval`/`evalsha` commands
|
142
|
+
* Add implementations for `SCAN` family (`sscan`/`hscan`/`zscan`)
|
143
|
+
family of commands
|
144
|
+
|
145
|
+
### 0.15.4
|
146
|
+
|
147
|
+
* Fix `zrange`/`zrevrange` to return elements with equal values in
|
148
|
+
lexicographic order
|
149
|
+
|
150
|
+
### 0.15.3
|
151
|
+
|
152
|
+
* Fix `sadd` to return integers when adding arrays
|
153
|
+
|
154
|
+
### 0.15.2
|
155
|
+
|
156
|
+
* Fix `zrangebyscore` to work with exclusive ranges on both ends of interval
|
157
|
+
|
158
|
+
### 0.15.1
|
159
|
+
|
160
|
+
* Fix `hmget` and `mapped_hmget` to allow passing of an array of keys
|
161
|
+
|
162
|
+
### 0.15.0
|
163
|
+
|
164
|
+
* Add support for the `time` method
|
165
|
+
|
166
|
+
### 0.14.1
|
167
|
+
|
168
|
+
* Upgrade `redis` gem dependency to 3.2.x series
|
169
|
+
* Map `HDEL` field to string when given as an array
|
170
|
+
|
171
|
+
### 0.14.0
|
172
|
+
|
173
|
+
* Fix bug where SETBIT command would not correctly unset a bit
|
174
|
+
* Fix bug where a key that expired would cause another key that expired later
|
175
|
+
to prematurely expire
|
176
|
+
* Add support to set methods to take array as argument
|
177
|
+
* Evaluate futures at the end of `#multi` blocks
|
178
|
+
* Add support for the SCAN command
|
179
|
+
* Add support for `[+/-]inf` values for min/max in ordered set commands
|
180
|
+
|
181
|
+
### 0.13.2
|
182
|
+
|
183
|
+
* Fix SMEMBERS command to not return frozen elements
|
184
|
+
|
185
|
+
### 0.13.1
|
186
|
+
|
187
|
+
* Fix bug where certain characters in keys were treated as regex characters
|
188
|
+
rather than literals
|
189
|
+
* Add back support for legacy integer timeouts on blocking list commands
|
190
|
+
|
191
|
+
### 0.13.0
|
192
|
+
|
193
|
+
* Fix bug where SETBIT command would not correctly unset a bit
|
194
|
+
* Add support for the `connect` method
|
195
|
+
* Check that `min`/`max` parameters are floats in `zrangebyscore`,
|
196
|
+
`zremrangebyscore`, and `zrevrangebyscore`
|
197
|
+
* Update blocking list commands to take `timeout` in an options hash
|
198
|
+
for compatibility with `redis-rb` >= 3.0.0
|
199
|
+
|
200
|
+
### 0.12.1
|
201
|
+
|
202
|
+
* RENAME command now keeps key expiration
|
203
|
+
|
204
|
+
### 0.12.0
|
205
|
+
|
206
|
+
* Fix bug where `del` would not raise error when given empty array
|
207
|
+
* Add support for the BITCOUNT command
|
208
|
+
|
209
|
+
### 0.11.0
|
210
|
+
|
211
|
+
* Raise errors for empty arrays as arguments
|
212
|
+
* Update error messages to conform to Redis 2.8. This officially means
|
213
|
+
`mock_redis` no *longer supports Redis 2.6 or lower*. All testing in
|
214
|
+
TravisCI is now done against 2.8
|
215
|
+
* Update return value of TTL to return -2 if key doesn't exist
|
216
|
+
* Add support for the HINCRBYFLOAT command
|
217
|
+
* Add support for `count` parameter on SRANDMEMBER
|
218
|
+
* Add support for the PTTL command
|
219
|
+
* Improve support for negative start indices in LRANGE
|
220
|
+
* Improve support for negative start indices in LTRIM
|
221
|
+
* Allow `del` to accept arrays of keys
|
222
|
+
|
223
|
+
### 0.10.0
|
224
|
+
* Add support for :nx, :xx, :ex, :px options for SET command
|
225
|
+
|
226
|
+
### 0.9.0
|
227
|
+
* Added futures support
|
228
|
+
|
229
|
+
### 0.8.2
|
230
|
+
* Added support for Ruby 2.0.0, dropped support for Ruby 1.8.7
|
231
|
+
* Changes for compatibility with JRuby
|
232
|
+
|
233
|
+
### 0.8.1
|
234
|
+
* Fix `#pipelined` to yield self
|
235
|
+
|
236
|
+
### 0.8.0
|
237
|
+
* Fixed `watch` to return OK when passed no block
|
238
|
+
* Implemented `pexpire`, `pexpireat`
|
239
|
+
* Fixed `expire` to use millisecond precision
|
240
|
+
|
241
|
+
### 0.7.0
|
242
|
+
* Implemented `mapped_mget`, `mapped_mset`, `mapped_msetnx`
|
243
|
+
* Fixed `rpoplpush` when the `rpop` is nil
|
244
|
+
|
245
|
+
### 0.6.6
|
246
|
+
* Avoid mutation of @data from external reference
|
247
|
+
* Fix sorted set (e.g. `zadd`) with multiple score/member pairs
|
248
|
+
|
249
|
+
### 0.6.5
|
250
|
+
* Fix `zrevrange` to return an empty array on invalid range
|
251
|
+
* Fix `srandmember` spec on redis-rb 3.0.3
|
252
|
+
* Stringify keys in expiration-related commands
|
253
|
+
|
254
|
+
### 0.6.4
|
255
|
+
* Update INFO command for latest Redis 2.6 compatibility
|
256
|
+
|
257
|
+
### 0.6.3
|
258
|
+
* Treat symbols as strings for keys
|
259
|
+
* Add #reconnect method (no-op)
|
260
|
+
|
261
|
+
### 0.6.2
|
262
|
+
* Support for `connected?`, `disconnect` (no-op)
|
263
|
+
* Fix `*` in `keys` to support 0 or more
|
264
|
+
|
265
|
+
### 0.6.1
|
266
|
+
* Support default argument of `*` for keys
|
267
|
+
* Allow `MockRedis` to take a TimeClass
|
268
|
+
|
269
|
+
### 0.6.0
|
270
|
+
* Support for `#sort` (ascending and descending only)
|
271
|
+
|
272
|
+
### 0.5.5
|
273
|
+
* Support exclusive ranges in `zcount`
|
274
|
+
* List methods (`lindex`, `lrange`, `lset`, and `ltrim`) can take string indexes
|
275
|
+
* Fix typo in shared example `zset` spec
|
276
|
+
* Fix `lrange` to return `[]` when start is too large
|
277
|
+
* Update readme about spec suite compatibility
|
278
|
+
|
1
279
|
### 0.5.4
|
2
280
|
* Support `incrbyfloat` (new in Redis 2.6)
|
3
281
|
* Fix specs to pass in Redis 2.6
|
data/Gemfile
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in mock_redis.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
# Run all pre-commit hooks via Overcommit during CI runs
|
7
|
+
gem 'overcommit', '0.53.0'
|
8
|
+
|
9
|
+
# Pin tool versions (which are executed by Overcommit) for Travis builds
|
10
|
+
gem 'rubocop', '0.82.0'
|
11
|
+
|
12
|
+
gem 'simplecov', '~> 0.21.0'
|
13
|
+
gem 'simplecov-lcov', '~> 0.8.0'
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MockRedis released under the MIT license.
|
2
|
+
|
3
|
+
> Copyright (c) Shane da Silva. http://shane.io
|
4
|
+
>
|
5
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
> of this software and associated documentation files (the "Software"), to deal
|
7
|
+
> in the Software without restriction, including without limitation the rights
|
8
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
> copies of the Software, and to permit persons to whom the Software is
|
10
|
+
> furnished to do so, subject to the following conditions:
|
11
|
+
>
|
12
|
+
> The above copyright notice and this permission notice shall be included in
|
13
|
+
> all copies or substantial portions of the Software.
|
14
|
+
>
|
15
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
> SOFTWARE.
|