mock_redis 0.6.1 → 0.6.2
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.
- data/CHANGELOG.md +4 -0
- data/lib/mock_redis/database.rb +9 -1
- data/lib/mock_redis/version.rb +1 -1
- data/spec/commands/connected_spec.rb +7 -0
- data/spec/commands/disconnect_spec.rb +7 -0
- data/spec/commands/keys_spec.rb +3 -1
- metadata +6 -2
data/CHANGELOG.md
CHANGED
data/lib/mock_redis/database.rb
CHANGED
@@ -38,6 +38,14 @@ class MockRedis
|
|
38
38
|
|
39
39
|
def bgsave() "Background saving started" end
|
40
40
|
|
41
|
+
def disconnect
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def connected?
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
41
49
|
def dbsize
|
42
50
|
data.keys.length
|
43
51
|
end
|
@@ -404,7 +412,7 @@ class MockRedis
|
|
404
412
|
Regexp.new(
|
405
413
|
"^#{pattern}$".
|
406
414
|
gsub(/([^\\])\?/, "\\1.").
|
407
|
-
gsub(/([^\\])\*/, "\\1
|
415
|
+
gsub(/([^\\])\*/, "\\1.*"))
|
408
416
|
end
|
409
417
|
|
410
418
|
def remove_expiration(key)
|
data/lib/mock_redis/version.rb
CHANGED
data/spec/commands/keys_spec.rb
CHANGED
@@ -12,6 +12,7 @@ describe '#keys()' do
|
|
12
12
|
|
13
13
|
describe "with pattern matching" do
|
14
14
|
before do
|
15
|
+
@redises.set("mock-redis-test:key", 0)
|
15
16
|
@redises.set("mock-redis-test:key1", 1)
|
16
17
|
@redises.set("mock-redis-test:key2", 2)
|
17
18
|
@redises.set("mock-redis-test:key3", 3)
|
@@ -48,8 +49,9 @@ describe '#keys()' do
|
|
48
49
|
end
|
49
50
|
|
50
51
|
describe "the * character" do
|
51
|
-
it "is treated as
|
52
|
+
it "is treated as 0 or more characters" do
|
52
53
|
@redises.keys("mock-redis-test:key*").sort.should == [
|
54
|
+
'mock-redis-test:key',
|
53
55
|
'mock-redis-test:key1',
|
54
56
|
'mock-redis-test:key10',
|
55
57
|
'mock-redis-test:key2',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock_redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-11
|
13
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -103,10 +103,12 @@ files:
|
|
103
103
|
- spec/commands/blpop_spec.rb
|
104
104
|
- spec/commands/brpop_spec.rb
|
105
105
|
- spec/commands/brpoplpush_spec.rb
|
106
|
+
- spec/commands/connected_spec.rb
|
106
107
|
- spec/commands/dbsize_spec.rb
|
107
108
|
- spec/commands/decr_spec.rb
|
108
109
|
- spec/commands/decrby_spec.rb
|
109
110
|
- spec/commands/del_spec.rb
|
111
|
+
- spec/commands/disconnect_spec.rb
|
110
112
|
- spec/commands/echo_spec.rb
|
111
113
|
- spec/commands/exists_spec.rb
|
112
114
|
- spec/commands/expire_spec.rb
|
@@ -251,10 +253,12 @@ test_files:
|
|
251
253
|
- spec/commands/blpop_spec.rb
|
252
254
|
- spec/commands/brpop_spec.rb
|
253
255
|
- spec/commands/brpoplpush_spec.rb
|
256
|
+
- spec/commands/connected_spec.rb
|
254
257
|
- spec/commands/dbsize_spec.rb
|
255
258
|
- spec/commands/decr_spec.rb
|
256
259
|
- spec/commands/decrby_spec.rb
|
257
260
|
- spec/commands/del_spec.rb
|
261
|
+
- spec/commands/disconnect_spec.rb
|
258
262
|
- spec/commands/echo_spec.rb
|
259
263
|
- spec/commands/exists_spec.rb
|
260
264
|
- spec/commands/expire_spec.rb
|