mock_redis 0.36.0 → 0.38.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.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/mock_redis/database.rb +3 -1
  5. data/lib/mock_redis/hash_methods.rb +1 -1
  6. data/lib/mock_redis/list_methods.rb +7 -2
  7. data/lib/mock_redis/multi_db_wrapper.rb +1 -1
  8. data/lib/mock_redis/pipelined_wrapper.rb +12 -14
  9. data/lib/mock_redis/set_methods.rb +6 -1
  10. data/lib/mock_redis/stream.rb +3 -3
  11. data/lib/mock_redis/string_methods.rb +20 -5
  12. data/lib/mock_redis/transaction_wrapper.rb +5 -7
  13. data/lib/mock_redis/utility_methods.rb +4 -2
  14. data/lib/mock_redis/version.rb +1 -1
  15. data/lib/mock_redis/zset.rb +4 -2
  16. data/lib/mock_redis/zset_methods.rb +3 -3
  17. data/lib/mock_redis.rb +1 -2
  18. metadata +21 -362
  19. data/.github/workflows/lint.yml +0 -31
  20. data/.github/workflows/tests.yml +0 -63
  21. data/.gitignore +0 -5
  22. data/.mailmap +0 -2
  23. data/.overcommit.yml +0 -21
  24. data/.rspec +0 -1
  25. data/.rubocop.yml +0 -148
  26. data/.rubocop_todo.yml +0 -35
  27. data/.simplecov +0 -4
  28. data/Gemfile +0 -13
  29. data/Rakefile +0 -2
  30. data/mock_redis.gemspec +0 -32
  31. data/spec/client_spec.rb +0 -36
  32. data/spec/cloning_spec.rb +0 -95
  33. data/spec/commands/append_spec.rb +0 -24
  34. data/spec/commands/auth_spec.rb +0 -7
  35. data/spec/commands/bgrewriteaof_spec.rb +0 -7
  36. data/spec/commands/bgsave_spec.rb +0 -7
  37. data/spec/commands/bitcount_spec.rb +0 -25
  38. data/spec/commands/bitfield_spec.rb +0 -169
  39. data/spec/commands/blmove_spec.rb +0 -52
  40. data/spec/commands/blpop_spec.rb +0 -53
  41. data/spec/commands/brpop_spec.rb +0 -59
  42. data/spec/commands/brpoplpush_spec.rb +0 -52
  43. data/spec/commands/connected_spec.rb +0 -7
  44. data/spec/commands/connection_spec.rb +0 -15
  45. data/spec/commands/dbsize_spec.rb +0 -18
  46. data/spec/commands/decr_spec.rb +0 -34
  47. data/spec/commands/decrby_spec.rb +0 -34
  48. data/spec/commands/del_spec.rb +0 -52
  49. data/spec/commands/disconnect_spec.rb +0 -7
  50. data/spec/commands/dump_spec.rb +0 -19
  51. data/spec/commands/echo_spec.rb +0 -11
  52. data/spec/commands/eval_spec.rb +0 -7
  53. data/spec/commands/evalsha_spec.rb +0 -10
  54. data/spec/commands/exists_spec.rb +0 -43
  55. data/spec/commands/expire_spec.rb +0 -111
  56. data/spec/commands/expireat_spec.rb +0 -47
  57. data/spec/commands/flushall_spec.rb +0 -38
  58. data/spec/commands/flushdb_spec.rb +0 -38
  59. data/spec/commands/future_spec.rb +0 -30
  60. data/spec/commands/geoadd_spec.rb +0 -58
  61. data/spec/commands/geodist_spec.rb +0 -118
  62. data/spec/commands/geohash_spec.rb +0 -52
  63. data/spec/commands/geopos_spec.rb +0 -55
  64. data/spec/commands/get_spec.rb +0 -31
  65. data/spec/commands/getbit_spec.rb +0 -34
  66. data/spec/commands/getdel.rb +0 -24
  67. data/spec/commands/getrange_spec.rb +0 -22
  68. data/spec/commands/getset_spec.rb +0 -23
  69. data/spec/commands/hdel_spec.rb +0 -77
  70. data/spec/commands/hexists_spec.rb +0 -27
  71. data/spec/commands/hget_spec.rb +0 -28
  72. data/spec/commands/hgetall_spec.rb +0 -32
  73. data/spec/commands/hincrby_spec.rb +0 -58
  74. data/spec/commands/hincrbyfloat_spec.rb +0 -58
  75. data/spec/commands/hkeys_spec.rb +0 -19
  76. data/spec/commands/hlen_spec.rb +0 -19
  77. data/spec/commands/hmget_spec.rb +0 -46
  78. data/spec/commands/hmset_spec.rb +0 -69
  79. data/spec/commands/hscan_each_spec.rb +0 -48
  80. data/spec/commands/hscan_spec.rb +0 -27
  81. data/spec/commands/hset_spec.rb +0 -42
  82. data/spec/commands/hsetnx_spec.rb +0 -44
  83. data/spec/commands/hvals_spec.rb +0 -19
  84. data/spec/commands/incr_spec.rb +0 -34
  85. data/spec/commands/incrby_spec.rb +0 -44
  86. data/spec/commands/incrbyfloat_spec.rb +0 -44
  87. data/spec/commands/info_spec.rb +0 -62
  88. data/spec/commands/keys_spec.rb +0 -139
  89. data/spec/commands/lastsave_spec.rb +0 -8
  90. data/spec/commands/lindex_spec.rb +0 -49
  91. data/spec/commands/linsert_spec.rb +0 -68
  92. data/spec/commands/llen_spec.rb +0 -16
  93. data/spec/commands/lmove_spec.rb +0 -72
  94. data/spec/commands/lpop_spec.rb +0 -35
  95. data/spec/commands/lpush_spec.rb +0 -43
  96. data/spec/commands/lpushx_spec.rb +0 -46
  97. data/spec/commands/lrange_spec.rb +0 -51
  98. data/spec/commands/lrem_spec.rb +0 -80
  99. data/spec/commands/lset_spec.rb +0 -43
  100. data/spec/commands/ltrim_spec.rb +0 -45
  101. data/spec/commands/mapped_hmget_spec.rb +0 -29
  102. data/spec/commands/mapped_hmset_spec.rb +0 -47
  103. data/spec/commands/mapped_mget_spec.rb +0 -22
  104. data/spec/commands/mapped_mset_spec.rb +0 -19
  105. data/spec/commands/mapped_msetnx_spec.rb +0 -26
  106. data/spec/commands/mget_spec.rb +0 -65
  107. data/spec/commands/move_spec.rb +0 -147
  108. data/spec/commands/mset_spec.rb +0 -43
  109. data/spec/commands/msetnx_spec.rb +0 -40
  110. data/spec/commands/persist_spec.rb +0 -48
  111. data/spec/commands/pexpire_spec.rb +0 -86
  112. data/spec/commands/pexpireat_spec.rb +0 -48
  113. data/spec/commands/ping_spec.rb +0 -11
  114. data/spec/commands/pipelined_spec.rb +0 -114
  115. data/spec/commands/psetex_spec.rb +0 -44
  116. data/spec/commands/pttl_spec.rb +0 -41
  117. data/spec/commands/quit_spec.rb +0 -7
  118. data/spec/commands/randomkey_spec.rb +0 -20
  119. data/spec/commands/rename_spec.rb +0 -42
  120. data/spec/commands/renamenx_spec.rb +0 -41
  121. data/spec/commands/restore_spec.rb +0 -47
  122. data/spec/commands/rpop_spec.rb +0 -35
  123. data/spec/commands/rpoplpush_spec.rb +0 -50
  124. data/spec/commands/rpush_spec.rb +0 -43
  125. data/spec/commands/rpushx_spec.rb +0 -46
  126. data/spec/commands/sadd_spec.rb +0 -45
  127. data/spec/commands/save_spec.rb +0 -7
  128. data/spec/commands/scan_each_spec.rb +0 -39
  129. data/spec/commands/scan_spec.rb +0 -64
  130. data/spec/commands/scard_spec.rb +0 -18
  131. data/spec/commands/script_spec.rb +0 -9
  132. data/spec/commands/sdiff_spec.rb +0 -47
  133. data/spec/commands/sdiffstore_spec.rb +0 -58
  134. data/spec/commands/select_spec.rb +0 -61
  135. data/spec/commands/set_spec.rb +0 -134
  136. data/spec/commands/setbit_spec.rb +0 -55
  137. data/spec/commands/setex_spec.rb +0 -38
  138. data/spec/commands/setnx_spec.rb +0 -25
  139. data/spec/commands/setrange_spec.rb +0 -30
  140. data/spec/commands/sinter_spec.rb +0 -39
  141. data/spec/commands/sinterstore_spec.rb +0 -53
  142. data/spec/commands/sismember_spec.rb +0 -29
  143. data/spec/commands/smembers_spec.rb +0 -28
  144. data/spec/commands/smismember_spec.rb +0 -34
  145. data/spec/commands/smove_spec.rb +0 -41
  146. data/spec/commands/sort_list_spec.rb +0 -21
  147. data/spec/commands/sort_set_spec.rb +0 -21
  148. data/spec/commands/sort_zset_spec.rb +0 -21
  149. data/spec/commands/spop_spec.rb +0 -40
  150. data/spec/commands/srandmember_spec.rb +0 -49
  151. data/spec/commands/srem_spec.rb +0 -45
  152. data/spec/commands/sscan_each_spec.rb +0 -48
  153. data/spec/commands/sscan_spec.rb +0 -39
  154. data/spec/commands/strlen_spec.rb +0 -18
  155. data/spec/commands/sunion_spec.rb +0 -42
  156. data/spec/commands/sunionstore_spec.rb +0 -59
  157. data/spec/commands/ttl_spec.rb +0 -40
  158. data/spec/commands/type_spec.rb +0 -36
  159. data/spec/commands/unwatch_spec.rb +0 -7
  160. data/spec/commands/watch_spec.rb +0 -21
  161. data/spec/commands/xadd_spec.rb +0 -122
  162. data/spec/commands/xlen_spec.rb +0 -22
  163. data/spec/commands/xrange_spec.rb +0 -164
  164. data/spec/commands/xread_spec.rb +0 -66
  165. data/spec/commands/xrevrange_spec.rb +0 -130
  166. data/spec/commands/xtrim_spec.rb +0 -36
  167. data/spec/commands/zadd_spec.rb +0 -129
  168. data/spec/commands/zcard_spec.rb +0 -19
  169. data/spec/commands/zcount_spec.rb +0 -39
  170. data/spec/commands/zincrby_spec.rb +0 -31
  171. data/spec/commands/zinterstore_spec.rb +0 -130
  172. data/spec/commands/zpopmax_spec.rb +0 -60
  173. data/spec/commands/zpopmin_spec.rb +0 -60
  174. data/spec/commands/zrange_spec.rb +0 -80
  175. data/spec/commands/zrangebyscore_spec.rb +0 -83
  176. data/spec/commands/zrank_spec.rb +0 -29
  177. data/spec/commands/zrem_spec.rb +0 -50
  178. data/spec/commands/zremrangebyrank_spec.rb +0 -27
  179. data/spec/commands/zremrangebyscore_spec.rb +0 -35
  180. data/spec/commands/zrevrange_spec.rb +0 -56
  181. data/spec/commands/zrevrangebyscore_spec.rb +0 -58
  182. data/spec/commands/zrevrank_spec.rb +0 -29
  183. data/spec/commands/zscan_each_spec.rb +0 -48
  184. data/spec/commands/zscan_spec.rb +0 -26
  185. data/spec/commands/zscore_spec.rb +0 -22
  186. data/spec/commands/zunionstore_spec.rb +0 -137
  187. data/spec/mock_redis_spec.rb +0 -93
  188. data/spec/spec_helper.rb +0 -74
  189. data/spec/support/redis_multiplexer.rb +0 -123
  190. data/spec/support/shared_examples/does_not_cleanup_empty_strings.rb +0 -14
  191. data/spec/support/shared_examples/only_operates_on_hashes.rb +0 -15
  192. data/spec/support/shared_examples/only_operates_on_lists.rb +0 -15
  193. data/spec/support/shared_examples/only_operates_on_sets.rb +0 -15
  194. data/spec/support/shared_examples/only_operates_on_strings.rb +0 -13
  195. data/spec/support/shared_examples/only_operates_on_zsets.rb +0 -59
  196. data/spec/support/shared_examples/sorts_enumerables.rb +0 -56
  197. data/spec/transactions_spec.rb +0 -163
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dac18dd7d43fb11953bf9988a89d64d8f82a0d6b909836d215880b5fc6c75e98
4
- data.tar.gz: e34af1ec074a43fbdeefa25e27543c57a146e0e22900842875adfca1fed3a698
3
+ metadata.gz: a52765650d476204f43e76ce502749a8c8efb65869930fe3096d69d1fe0ce40d
4
+ data.tar.gz: ff2348f833c9c973da379adb3d0abd51b1d67676234c6e3d4649a2130e055fa0
5
5
  SHA512:
6
- metadata.gz: a47e3c68ad32983cd4017ba6541dbfe3004d197468179713d5102bbe094a9978256831f9ee3d3c9a7abf8ec0c07b18ee8c04b911e9ca326e8d04da8288b8131e
7
- data.tar.gz: 119d337effa67690de4754bfa9bfe37bcceade74089b73d8328fd7818877b14afb708ba432ea7b52c6299186d7dad736b14de95acde7bb51909ad6096eb1a143
6
+ metadata.gz: fd4da99b15267d322b320cfbd3533bacd24e8c4af28c4681e4ff9bedf18cbae9e9338f598904219bd743b44143e820415243e36f0a6da2ee5922926e5f5979fb
7
+ data.tar.gz: b33e8c8fb1943e88f3b8a7850268ae3627af27122a75cabfd1f76c5fd820118b7af8f840ae83a2830f9661750c76778fc2407accabb8d8c17c40d702c4f3321c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.38.0
4
+
5
+ * Fix detection of stream key types
6
+ * Add support for `EXAT` AND `PXAT` arguments to `SET` command
7
+
8
+ ### 0.37.0
9
+
10
+ * Require Ruby 2.7 or newer, since Ruby 2.6 and older are EOL
11
+ * Remove unnecessary files from gem contents
12
+ * Add support for popping multiple items with `lpop`
13
+ * Add support for `scan` with type option
14
+ * Add support for `sadd?`
15
+ * Add support for scanning on keys containing hash tags (`{...}`)
16
+
3
17
  ### 0.36.0
4
18
 
5
19
  * Add support for `smismember`
data/README.md CHANGED
@@ -10,7 +10,7 @@ for use in tests.
10
10
 
11
11
  ## Requirements
12
12
 
13
- Ruby 2.6+
13
+ Ruby 2.7+
14
14
 
15
15
  The current implementation is tested against Redis 6.2. Older versions may work, but can also return different results or not support some commands.
16
16
 
@@ -267,6 +267,8 @@ class MockRedis
267
267
  'set'
268
268
  elsif zsety?(key)
269
269
  'zset'
270
+ elsif streamy?(key)
271
+ 'stream'
270
272
  else
271
273
  raise ArgumentError, "Not sure how #{data[key].inspect} got in here"
272
274
  end
@@ -336,7 +338,7 @@ class MockRedis
336
338
  def redis_pattern_to_ruby_regex(pattern)
337
339
  Regexp.new(
338
340
  "^#{pattern}$".
339
- gsub(/([+|()])/, '\\\\\1').
341
+ gsub(/([+|(){}])/, '\\\\\1').
340
342
  gsub(/(?<!\\)\?/, '\\1.').
341
343
  gsub(/([^\\])\*/, '\\1.*')
342
344
  )
@@ -93,7 +93,7 @@ class MockRedis
93
93
  def hmset(key, *kvpairs)
94
94
  if key.is_a? Array
95
95
  err_msg = 'ERR wrong number of arguments for \'hmset\' command'
96
- kvpairs = key[1..-1]
96
+ kvpairs = key[1..]
97
97
  key = key[0]
98
98
  end
99
99
 
@@ -108,8 +108,13 @@ class MockRedis
108
108
  value
109
109
  end
110
110
 
111
- def lpop(key)
112
- with_list_at(key, &:shift)
111
+ def lpop(key, count = nil)
112
+ return with_list_at(key, &:shift) if count.nil?
113
+
114
+ record_count = llen(key)
115
+ return nil if record_count.zero?
116
+
117
+ [record_count, count].min.times.map { with_list_at(key, &:shift) }
113
118
  end
114
119
 
115
120
  def lpush(key, values)
@@ -31,7 +31,7 @@ class MockRedis
31
31
 
32
32
  # Redis commands
33
33
  def flushall
34
- @databases.values.each(&:flushdb)
34
+ @databases.each_value(&:flushdb)
35
35
  'OK'
36
36
  end
37
37
 
@@ -41,22 +41,20 @@ class MockRedis
41
41
  end
42
42
 
43
43
  responses = @pipelined_futures.flat_map do |future|
44
- begin
45
- result = if future.block
46
- send(*future.command, &future.block)
47
- else
48
- send(*future.command)
49
- end
50
- future.store_result(result)
44
+ result = if future.block
45
+ send(*future.command, &future.block)
46
+ else
47
+ send(*future.command)
48
+ end
49
+ future.store_result(result)
51
50
 
52
- if future.block
53
- result
54
- else
55
- [result]
56
- end
57
- rescue StandardError => e
58
- e
51
+ if future.block
52
+ result
53
+ else
54
+ [result]
59
55
  end
56
+ rescue StandardError => e
57
+ e
60
58
  end
61
59
  @pipelined_futures = []
62
60
  responses
@@ -27,6 +27,11 @@ class MockRedis
27
27
  end
28
28
  end
29
29
 
30
+ def sadd?(key, members)
31
+ res = sadd(key, members)
32
+ res.is_a?(Numeric) ? res > 0 : res
33
+ end
34
+
30
35
  def scard(key)
31
36
  with_set_at(key, &:length)
32
37
  end
@@ -171,7 +176,7 @@ class MockRedis
171
176
  with_set_at(keys.first, &blk)
172
177
  else
173
178
  with_set_at(keys.first) do |set|
174
- with_sets_at(*(keys[1..-1])) do |*sets|
179
+ with_sets_at(*(keys[1..])) do |*sets|
175
180
  yield(*([set] + sets))
176
181
  end
177
182
  end
@@ -37,7 +37,7 @@ class MockRedis
37
37
  @members = if count == 0
38
38
  Set.new
39
39
  else
40
- @members.to_a[-count..-1].to_set
40
+ @members.to_a[-count..].to_set
41
41
  end
42
42
  deleted
43
43
  else
@@ -71,8 +71,8 @@ class MockRedis
71
71
  items
72
72
  end
73
73
 
74
- def each
75
- members.each { |m| yield m }
74
+ def each(&block)
75
+ members.each(&block)
76
76
  end
77
77
 
78
78
  private
@@ -38,7 +38,7 @@ class MockRedis
38
38
  type, offset = args.shift(2)
39
39
 
40
40
  is_signed = type.slice(0) == 'i'
41
- type_size = type[1..-1].to_i
41
+ type_size = type[1..].to_i
42
42
 
43
43
  if (type_size > 64 && is_signed) || (type_size >= 64 && !is_signed)
44
44
  raise Redis::CommandError,
@@ -47,7 +47,7 @@ class MockRedis
47
47
  end
48
48
 
49
49
  if offset.to_s[0] == '#'
50
- offset = offset[1..-1].to_i * type_size
50
+ offset = offset[1..].to_i * type_size
51
51
  end
52
52
 
53
53
  bits = []
@@ -210,9 +210,10 @@ class MockRedis
210
210
  msetnx(*hash.to_a.flatten)
211
211
  end
212
212
 
213
- # Parameer list required to ensure the ArgumentError is returned correctly
213
+ # Parameter list required to ensure the ArgumentError is returned correctly
214
214
  # rubocop:disable Metrics/ParameterLists
215
- def set(key, value, ex: nil, px: nil, nx: nil, xx: nil, keepttl: nil, get: nil)
215
+ def set(key, value, ex: nil, px: nil, exat: nil, pxat: nil, nx: nil, xx: nil, keepttl: nil,
216
+ get: nil)
216
217
  key = key.to_s
217
218
  retval = self.get(key) if get
218
219
 
@@ -248,6 +249,20 @@ class MockRedis
248
249
  pexpire(key, px)
249
250
  end
250
251
 
252
+ if exat
253
+ if exat == 0
254
+ raise Redis::CommandError, 'ERR invalid expire time in set'
255
+ end
256
+ expireat(key, exat)
257
+ end
258
+
259
+ if pxat
260
+ if pxat == 0
261
+ raise Redis::CommandError, 'ERR invalid expire time in set'
262
+ end
263
+ pexpireat(key, pxat)
264
+ end
265
+
251
266
  if get
252
267
  retval
253
268
  else
@@ -365,7 +380,7 @@ class MockRedis
365
380
  old_value = (data[key] || '')
366
381
 
367
382
  prefix = zero_pad(old_value[0...offset], offset)
368
- data[key] = prefix + value + (old_value[(offset + value.length)..-1] || '')
383
+ data[key] = prefix + value + (old_value[(offset + value.length)..] || '')
369
384
  data[key].length
370
385
  end
371
386
 
@@ -57,13 +57,11 @@ class MockRedis
57
57
  @multi_block_given = false
58
58
 
59
59
  responses = @transaction_futures.map do |future|
60
- begin
61
- result = send(*future.command)
62
- future.store_result(result)
63
- future.value
64
- rescue StandardError => e
65
- e
66
- end
60
+ result = send(*future.command)
61
+ future.store_result(result)
62
+ future.value
63
+ rescue StandardError => e
64
+ e
67
65
  end
68
66
 
69
67
  @transaction_futures = []
@@ -28,6 +28,7 @@ class MockRedis
28
28
  cursor = cursor.to_i
29
29
  match = opts[:match] || '*'
30
30
  key = opts[:key] || lambda { |x| x }
31
+ type_opt = opts[:type]
31
32
  filtered_values = []
32
33
 
33
34
  limit = cursor + count
@@ -35,7 +36,8 @@ class MockRedis
35
36
 
36
37
  unless values[cursor...limit].nil?
37
38
  filtered_values = values[cursor...limit].select do |val|
38
- redis_pattern_to_ruby_regex(match).match(key.call(val))
39
+ redis_pattern_to_ruby_regex(match).match(key.call(val)) &&
40
+ (type_opt.nil? || type(val) == type_opt)
39
41
  end
40
42
  end
41
43
 
@@ -68,7 +70,7 @@ class MockRedis
68
70
  end
69
71
 
70
72
  def left_pad(str, size)
71
- str = '0' + str while str.length < size
73
+ str = "0#{str}" while str.length < size
72
74
 
73
75
  str
74
76
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  class MockRedis
5
- VERSION = '0.36.0'
5
+ VERSION = '0.38.0'
6
6
  end
@@ -10,9 +10,11 @@ class MockRedis
10
10
 
11
11
  def_delegators :members, :empty?, :include?, :size
12
12
 
13
- def initialize
13
+ def initialize(enum = nil)
14
14
  @members = Set.new
15
- @scores = {}
15
+ @members.merge(enum) if enum
16
+
17
+ @scores = {}
16
18
  end
17
19
 
18
20
  def initialize_copy(source)
@@ -26,7 +26,7 @@ class MockRedis
26
26
  end
27
27
 
28
28
  def zadd_one_member(key, score, member, zadd_options = {})
29
- assert_scorey(score) unless score.to_s =~ /(\+|\-)inf/
29
+ assert_scorey(score) unless score.to_s =~ /(\+|-)inf/
30
30
 
31
31
  with_zset_at(key) do |zset|
32
32
  if zadd_options[:incr]
@@ -316,7 +316,7 @@ class MockRedis
316
316
  with_zset_at(keys.first, coercible: coercible, &blk)
317
317
  else
318
318
  with_zset_at(keys.first, coercible: coercible) do |set|
319
- with_zsets_at(*(keys[1..-1]), coercible: coercible) do |*sets|
319
+ with_zsets_at(*(keys[1..]), coercible: coercible) do |*sets|
320
320
  yield(*([set] + sets))
321
321
  end
322
322
  end
@@ -351,7 +351,7 @@ class MockRedis
351
351
  end
352
352
 
353
353
  def assert_scorey(value, message = 'ERR value is not a valid float')
354
- return if value.to_s =~ /\(?(\-|\+)inf/
354
+ return if value.to_s =~ /\(?(-|\+)inf/
355
355
 
356
356
  value = $1 if value.to_s =~ /\((.*)/
357
357
  unless looks_like_float?(value)
data/lib/mock_redis.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'set'
2
- require 'ruby2_keywords'
3
2
 
4
3
  require 'mock_redis/assertions'
5
4
  require 'mock_redis/database'
@@ -130,7 +129,7 @@ class MockRedis
130
129
  defaults[:host] = uri.host
131
130
  defaults[:port] = uri.port if uri.port
132
131
  defaults[:password] = uri.password if uri.password
133
- defaults[:db] = uri.path[1..-1].to_i if uri.path
132
+ defaults[:db] = uri.path[1..].to_i if uri.path
134
133
  end
135
134
  end
136
135