ryansch-mock_redis 0.2.0.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/mock_redis/string_methods.rb +8 -0
- data/lib/mock_redis/version.rb +1 -1
- data/mock_redis.gemspec +1 -1
- data/spec/commands/hash_operator_spec.rb +21 -0
- metadata +22 -19
data/CHANGELOG.md
CHANGED
@@ -24,6 +24,10 @@ class MockRedis
|
|
24
24
|
data[key]
|
25
25
|
end
|
26
26
|
|
27
|
+
def [](key)
|
28
|
+
get(key)
|
29
|
+
end
|
30
|
+
|
27
31
|
def getbit(key, offset)
|
28
32
|
assert_stringy(key)
|
29
33
|
|
@@ -108,6 +112,10 @@ class MockRedis
|
|
108
112
|
'OK'
|
109
113
|
end
|
110
114
|
|
115
|
+
def []=(key, value)
|
116
|
+
set(key, value)
|
117
|
+
end
|
118
|
+
|
111
119
|
def setbit(key, offset, value)
|
112
120
|
assert_stringy(key, "ERR bit is not an integer or out of range")
|
113
121
|
retval = getbit(key, offset)
|
data/lib/mock_redis/version.rb
CHANGED
data/mock_redis.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
+
s.add_development_dependency "rake", "~> 0.9.2"
|
21
22
|
s.add_development_dependency "redis", "~> 2.2.1"
|
22
23
|
s.add_development_dependency "rspec", "~> 2.6.0"
|
23
|
-
s.add_development_dependency "ZenTest"
|
24
24
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "#[](key)" do
|
4
|
+
before do
|
5
|
+
@key = 'mock-redis-test:hash_operator'
|
6
|
+
end
|
7
|
+
|
8
|
+
it "returns nil for a nonexistent value" do
|
9
|
+
@redises['mock-redis-test:does-not-exist'].should be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "returns a stored string value" do
|
13
|
+
@redises[@key] = 'forsooth'
|
14
|
+
@redises[@key].should == 'forsooth'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "treats integers as strings" do
|
18
|
+
@redises[@key] = 100
|
19
|
+
@redises[@key].should == "100"
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ryansch-mock_redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
|
11
|
-
version: 0.2.0.2
|
10
|
+
version: 0.3.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Samuel Merritt
|
@@ -17,52 +16,54 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2011-12-
|
19
|
+
date: 2011-12-14 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
|
-
name:
|
22
|
+
name: rake
|
24
23
|
prerelease: false
|
25
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
25
|
none: false
|
27
26
|
requirements:
|
28
27
|
- - ~>
|
29
28
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
29
|
+
hash: 63
|
31
30
|
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
32
33
|
- 2
|
33
|
-
|
34
|
-
- 1
|
35
|
-
version: 2.2.1
|
34
|
+
version: 0.9.2
|
36
35
|
type: :development
|
37
36
|
version_requirements: *id001
|
38
37
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
38
|
+
name: redis
|
40
39
|
prerelease: false
|
41
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
42
|
requirements:
|
44
43
|
- - ~>
|
45
44
|
- !ruby/object:Gem::Version
|
46
|
-
hash:
|
45
|
+
hash: 5
|
47
46
|
segments:
|
48
47
|
- 2
|
49
|
-
-
|
50
|
-
-
|
51
|
-
version: 2.
|
48
|
+
- 2
|
49
|
+
- 1
|
50
|
+
version: 2.2.1
|
52
51
|
type: :development
|
53
52
|
version_requirements: *id002
|
54
53
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
54
|
+
name: rspec
|
56
55
|
prerelease: false
|
57
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
58
57
|
none: false
|
59
58
|
requirements:
|
60
|
-
- -
|
59
|
+
- - ~>
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
hash:
|
61
|
+
hash: 23
|
63
62
|
segments:
|
63
|
+
- 2
|
64
|
+
- 6
|
64
65
|
- 0
|
65
|
-
version:
|
66
|
+
version: 2.6.0
|
66
67
|
type: :development
|
67
68
|
version_requirements: *id003
|
68
69
|
description: Instantiate one with `redis = MockRedis.new` and treat it like you would a normal Redis object. It supports all the usual Redis operations.
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- spec/commands/getbit_spec.rb
|
122
123
|
- spec/commands/getrange_spec.rb
|
123
124
|
- spec/commands/getset_spec.rb
|
125
|
+
- spec/commands/hash_operator_spec.rb
|
124
126
|
- spec/commands/hdel_spec.rb
|
125
127
|
- spec/commands/hexists_spec.rb
|
126
128
|
- spec/commands/hget_spec.rb
|
@@ -268,6 +270,7 @@ test_files:
|
|
268
270
|
- spec/commands/getbit_spec.rb
|
269
271
|
- spec/commands/getrange_spec.rb
|
270
272
|
- spec/commands/getset_spec.rb
|
273
|
+
- spec/commands/hash_operator_spec.rb
|
271
274
|
- spec/commands/hdel_spec.rb
|
272
275
|
- spec/commands/hexists_spec.rb
|
273
276
|
- spec/commands/hget_spec.rb
|