mock_redis 0.14.1 → 0.15.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 (159) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.overcommit.yml +1 -1
  4. data/.rubocop.yml +91 -0
  5. data/.simplecov +4 -0
  6. data/.travis.yml +14 -2
  7. data/CHANGELOG.md +4 -0
  8. data/Gemfile +4 -2
  9. data/README.md +1 -0
  10. data/Rakefile +2 -2
  11. data/lib/mock_redis.rb +25 -26
  12. data/lib/mock_redis/assertions.rb +0 -1
  13. data/lib/mock_redis/database.rb +35 -28
  14. data/lib/mock_redis/expire_wrapper.rb +1 -1
  15. data/lib/mock_redis/future.rb +1 -1
  16. data/lib/mock_redis/hash_methods.rb +18 -17
  17. data/lib/mock_redis/indifferent_hash.rb +4 -0
  18. data/lib/mock_redis/info_method.rb +109 -108
  19. data/lib/mock_redis/list_methods.rb +17 -16
  20. data/lib/mock_redis/multi_db_wrapper.rb +5 -4
  21. data/lib/mock_redis/pipelined_wrapper.rb +3 -3
  22. data/lib/mock_redis/set_methods.rb +10 -9
  23. data/lib/mock_redis/sort_method.rb +11 -12
  24. data/lib/mock_redis/string_methods.rb +26 -29
  25. data/lib/mock_redis/transaction_wrapper.rb +7 -8
  26. data/lib/mock_redis/utility_methods.rb +9 -12
  27. data/lib/mock_redis/version.rb +1 -1
  28. data/lib/mock_redis/zset.rb +22 -23
  29. data/lib/mock_redis/zset_methods.rb +25 -25
  30. data/spec/cloning_spec.rb +17 -18
  31. data/spec/commands/append_spec.rb +4 -4
  32. data/spec/commands/auth_spec.rb +1 -1
  33. data/spec/commands/bgrewriteaof_spec.rb +2 -2
  34. data/spec/commands/bgsave_spec.rb +2 -2
  35. data/spec/commands/bitcount_spec.rb +3 -3
  36. data/spec/commands/blpop_spec.rb +10 -10
  37. data/spec/commands/brpop_spec.rb +10 -10
  38. data/spec/commands/brpoplpush_spec.rb +9 -9
  39. data/spec/commands/connected_spec.rb +2 -2
  40. data/spec/commands/dbsize_spec.rb +3 -3
  41. data/spec/commands/decr_spec.rb +7 -7
  42. data/spec/commands/decrby_spec.rb +7 -7
  43. data/spec/commands/del_spec.rb +4 -4
  44. data/spec/commands/disconnect_spec.rb +2 -2
  45. data/spec/commands/echo_spec.rb +4 -4
  46. data/spec/commands/exists_spec.rb +3 -3
  47. data/spec/commands/expire_spec.rb +13 -13
  48. data/spec/commands/expireat_spec.rb +6 -7
  49. data/spec/commands/flushall_spec.rb +5 -5
  50. data/spec/commands/flushdb_spec.rb +5 -5
  51. data/spec/commands/future_spec.rb +2 -2
  52. data/spec/commands/get_spec.rb +7 -7
  53. data/spec/commands/getbit_spec.rb +6 -6
  54. data/spec/commands/getrange_spec.rb +9 -9
  55. data/spec/commands/getset_spec.rb +7 -7
  56. data/spec/commands/hash_operator_spec.rb +5 -5
  57. data/spec/commands/hdel_spec.rb +12 -12
  58. data/spec/commands/hexists_spec.rb +7 -7
  59. data/spec/commands/hget_spec.rb +7 -7
  60. data/spec/commands/hgetall_spec.rb +6 -6
  61. data/spec/commands/hincrby_spec.rb +14 -14
  62. data/spec/commands/hincrbyfloat_spec.rb +14 -14
  63. data/spec/commands/hkeys_spec.rb +5 -5
  64. data/spec/commands/hlen_spec.rb +5 -5
  65. data/spec/commands/hmget_spec.rb +8 -8
  66. data/spec/commands/hmset_spec.rb +10 -10
  67. data/spec/commands/hset_spec.rb +11 -11
  68. data/spec/commands/hsetnx_spec.rb +14 -14
  69. data/spec/commands/hvals_spec.rb +5 -5
  70. data/spec/commands/incr_spec.rb +7 -7
  71. data/spec/commands/incrby_spec.rb +11 -11
  72. data/spec/commands/incrbyfloat_spec.rb +11 -11
  73. data/spec/commands/info_spec.rb +30 -30
  74. data/spec/commands/keys_spec.rb +42 -43
  75. data/spec/commands/lastsave_spec.rb +2 -2
  76. data/spec/commands/lindex_spec.rb +15 -15
  77. data/spec/commands/linsert_spec.rb +13 -13
  78. data/spec/commands/llen_spec.rb +4 -4
  79. data/spec/commands/lpop_spec.rb +6 -6
  80. data/spec/commands/lpush_spec.rb +16 -16
  81. data/spec/commands/lpushx_spec.rb +13 -13
  82. data/spec/commands/lrange_spec.rb +12 -12
  83. data/spec/commands/lrem_spec.rb +15 -15
  84. data/spec/commands/lset_spec.rb +12 -12
  85. data/spec/commands/ltrim_spec.rb +9 -9
  86. data/spec/commands/mapped_hmget_spec.rb +8 -8
  87. data/spec/commands/mapped_hmset_spec.rb +12 -12
  88. data/spec/commands/mapped_mget_spec.rb +4 -4
  89. data/spec/commands/mapped_mset_spec.rb +1 -1
  90. data/spec/commands/mget_spec.rb +11 -11
  91. data/spec/commands/move_spec.rb +29 -29
  92. data/spec/commands/mset_spec.rb +4 -4
  93. data/spec/commands/msetnx_spec.rb +10 -10
  94. data/spec/commands/persist_spec.rb +9 -10
  95. data/spec/commands/pexpire_spec.rb +12 -13
  96. data/spec/commands/pexpireat_spec.rb +6 -6
  97. data/spec/commands/ping_spec.rb +1 -1
  98. data/spec/commands/pipelined_spec.rb +5 -5
  99. data/spec/commands/pttl_spec.rb +5 -5
  100. data/spec/commands/randomkey_spec.rb +3 -3
  101. data/spec/commands/rename_spec.rb +9 -9
  102. data/spec/commands/renamenx_spec.rb +10 -10
  103. data/spec/commands/rpop_spec.rb +6 -6
  104. data/spec/commands/rpoplpush_spec.rb +7 -7
  105. data/spec/commands/rpush_spec.rb +16 -16
  106. data/spec/commands/rpushx_spec.rb +13 -13
  107. data/spec/commands/sadd_spec.rb +8 -9
  108. data/spec/commands/scan_spec.rb +6 -7
  109. data/spec/commands/scard_spec.rb +3 -3
  110. data/spec/commands/sdiff_spec.rb +10 -10
  111. data/spec/commands/sdiffstore_spec.rb +10 -10
  112. data/spec/commands/select_spec.rb +7 -7
  113. data/spec/commands/setbit_spec.rb +13 -13
  114. data/spec/commands/setex_spec.rb +4 -4
  115. data/spec/commands/setnx_spec.rb +4 -4
  116. data/spec/commands/setrange_spec.rb +12 -12
  117. data/spec/commands/sinter_spec.rb +8 -10
  118. data/spec/commands/sinterstore_spec.rb +9 -9
  119. data/spec/commands/sismember_spec.rb +5 -5
  120. data/spec/commands/smembers_spec.rb +5 -5
  121. data/spec/commands/smove_spec.rb +7 -7
  122. data/spec/commands/sort_list_spec.rb +3 -3
  123. data/spec/commands/sort_set_spec.rb +3 -3
  124. data/spec/commands/sort_zset_spec.rb +3 -3
  125. data/spec/commands/spop_spec.rb +4 -4
  126. data/spec/commands/srandmember_spec.rb +8 -8
  127. data/spec/commands/srem_spec.rb +9 -9
  128. data/spec/commands/strlen_spec.rb +4 -4
  129. data/spec/commands/sunion_spec.rb +7 -9
  130. data/spec/commands/sunionstore_spec.rb +9 -9
  131. data/spec/commands/ttl_spec.rb +5 -5
  132. data/spec/commands/type_spec.rb +1 -1
  133. data/spec/commands/zadd_spec.rb +10 -10
  134. data/spec/commands/zcard_spec.rb +4 -4
  135. data/spec/commands/zcount_spec.rb +14 -14
  136. data/spec/commands/zincrby_spec.rb +6 -6
  137. data/spec/commands/zinterstore_spec.rb +17 -17
  138. data/spec/commands/zrange_spec.rb +12 -12
  139. data/spec/commands/zrangebyscore_spec.rb +26 -26
  140. data/spec/commands/zrank_spec.rb +4 -4
  141. data/spec/commands/zrem_spec.rb +9 -9
  142. data/spec/commands/zremrangebyrank_spec.rb +5 -5
  143. data/spec/commands/zremrangebyscore_spec.rb +9 -7
  144. data/spec/commands/zrevrange_spec.rb +10 -10
  145. data/spec/commands/zrevrangebyscore_spec.rb +14 -14
  146. data/spec/commands/zrevrank_spec.rb +4 -4
  147. data/spec/commands/zscore_spec.rb +5 -5
  148. data/spec/commands/zunionstore_spec.rb +18 -18
  149. data/spec/mock_redis_spec.rb +11 -1
  150. data/spec/spec_helper.rb +13 -4
  151. data/spec/support/redis_multiplexer.rb +39 -31
  152. data/spec/support/shared_examples/only_operates_on_hashes.rb +2 -2
  153. data/spec/support/shared_examples/only_operates_on_lists.rb +2 -2
  154. data/spec/support/shared_examples/only_operates_on_sets.rb +2 -2
  155. data/spec/support/shared_examples/only_operates_on_strings.rb +3 -3
  156. data/spec/support/shared_examples/only_operates_on_zsets.rb +12 -12
  157. data/spec/support/shared_examples/sorts_enumerables.rb +12 -12
  158. data/spec/transactions_spec.rb +18 -18
  159. metadata +5 -3
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  class MockRedis
3
- VERSION = '0.14.1'
3
+ VERSION = '0.15.0'
4
4
  end
@@ -12,7 +12,7 @@ class MockRedis
12
12
 
13
13
  def initialize
14
14
  @members = Set.new
15
- @scores = Hash.new
15
+ @scores = {}
16
16
  end
17
17
 
18
18
  def initialize_copy(source)
@@ -33,39 +33,39 @@ class MockRedis
33
33
 
34
34
  def delete?(member)
35
35
  scores.delete(member)
36
- members.delete?(member) and self
36
+ members.delete?(member) && self
37
37
  end
38
38
 
39
39
  def each
40
- members.each {|m| yield score(m), m}
40
+ members.each { |m| yield score(m), m }
41
41
  end
42
42
 
43
43
  def in_range(min, max)
44
44
  in_from_the_left = case min
45
- when "-inf"
46
- lambda {|_| true }
47
- when "+inf"
48
- lambda {|_| false }
45
+ when '-inf'
46
+ lambda { |_| true }
47
+ when '+inf'
48
+ lambda { |_| false }
49
49
  when /\((.*)$/
50
- val = $1.to_f
51
- lambda {|x| x.to_f > val }
50
+ val = $1.to_f
51
+ lambda { |x| x.to_f > val }
52
52
  else
53
- lambda {|x| x.to_f >= min.to_f }
53
+ lambda { |x| x.to_f >= min.to_f }
54
54
  end
55
55
 
56
56
  in_from_the_right = case max
57
- when "-inf"
58
- lambda {|_| false }
59
- when "+inf"
60
- lambda {|_| true }
57
+ when '-inf'
58
+ lambda { |_| false }
59
+ when '+inf'
60
+ lambda { |_| true }
61
61
  when /\((.*)$/
62
- val = $1.to_f
63
- lambda {|x| x.to_f < val }
62
+ val = $1.to_f
63
+ lambda { |x| x.to_f < val }
64
64
  else
65
- lambda {|x| x.to_f <= max.to_f }
65
+ lambda { |x| x.to_f <= max.to_f }
66
66
  end
67
67
 
68
- sorted.find_all do |(score, member)|
68
+ sorted.find_all do |(score, _member)|
69
69
  in_from_the_left[score] && in_from_the_right[score]
70
70
  end
71
71
  end
@@ -74,8 +74,8 @@ class MockRedis
74
74
  if !block_given?
75
75
  intersection(other, &:+)
76
76
  else
77
- self.members.intersection(other.members).reduce(self.class.new) do |acc, m|
78
- new_score = yield(self.score(m), other.score(m))
77
+ members.intersection(other.members).reduce(self.class.new) do |acc, m|
78
+ new_score = yield(score(m), other.score(m))
79
79
  acc.add(new_score, m)
80
80
  end
81
81
  end
@@ -99,12 +99,11 @@ class MockRedis
99
99
  if !block_given?
100
100
  union(other, &:+)
101
101
  else
102
- self.members.union(other.members).reduce(self.class.new) do |acc, m|
103
- new_score = yield(self.score(m), other.score(m))
102
+ members.union(other.members).reduce(self.class.new) do |acc, m|
103
+ new_score = yield(score(m), other.score(m))
104
104
  acc.add(new_score, m)
105
105
  end
106
106
  end
107
107
  end
108
-
109
108
  end
110
109
  end
@@ -21,9 +21,9 @@ class MockRedis
21
21
  score, member = args
22
22
  assert_scorey(score) unless score =~ /(\+|\-)inf/
23
23
  retval = !zscore(key, member)
24
- with_zset_at(key) {|z| z.add(score, member.to_s)}
24
+ with_zset_at(key) { |z| z.add(score, member.to_s) }
25
25
  else
26
- raise Redis::CommandError, "ERR wrong number of arguments"
26
+ raise Redis::CommandError, 'ERR wrong number of arguments'
27
27
  end
28
28
 
29
29
  retval
@@ -52,20 +52,20 @@ class MockRedis
52
52
  end
53
53
  end
54
54
 
55
- def zinterstore(destination, keys, options={})
55
+ def zinterstore(destination, keys, options = {})
56
56
  assert_has_args(keys, 'zinterstore')
57
57
 
58
58
  data[destination] = combine_weighted_zsets(keys, options, :intersection)
59
59
  zcard(destination)
60
60
  end
61
61
 
62
- def zrange(key, start, stop, options={})
62
+ def zrange(key, start, stop, options = {})
63
63
  with_zset_at(key) do |z|
64
64
  to_response(z.sorted[start.to_i..stop.to_i] || [], options)
65
65
  end
66
66
  end
67
67
 
68
- def zrangebyscore(key, min, max, options={})
68
+ def zrangebyscore(key, min, max, options = {})
69
69
  assert_range_args(min, max)
70
70
 
71
71
  with_zset_at(key) do |zset|
@@ -75,12 +75,12 @@ class MockRedis
75
75
  end
76
76
 
77
77
  def zrank(key, member)
78
- with_zset_at(key) {|z| z.sorted_members.index(member.to_s) }
78
+ with_zset_at(key) { |z| z.sorted_members.index(member.to_s) }
79
79
  end
80
80
 
81
81
  def zrem(key, *args)
82
82
  if !args.first.is_a?(Array)
83
- retval = with_zset_at(key) {|z| !!z.delete?(args.first.to_s)}
83
+ retval = with_zset_at(key) { |z| !!z.delete?(args.first.to_s) }
84
84
  else
85
85
  args = args.first
86
86
  retval = args.map { |member| !!zscore(key, member.to_s) }.count(true)
@@ -92,7 +92,7 @@ class MockRedis
92
92
  retval
93
93
  end
94
94
 
95
- def zrevrange(key, start, stop, options={})
95
+ def zrevrange(key, start, stop, options = {})
96
96
  with_zset_at(key) do |z|
97
97
  to_response(z.sorted.reverse[start..stop] || [], options)
98
98
  end
@@ -100,7 +100,7 @@ class MockRedis
100
100
 
101
101
  def zremrangebyrank(key, start, stop)
102
102
  zrange(key, start, stop).
103
- each {|member| zrem(key, member)}.
103
+ each { |member| zrem(key, member) }.
104
104
  size
105
105
  end
106
106
 
@@ -108,11 +108,11 @@ class MockRedis
108
108
  assert_range_args(min, max)
109
109
 
110
110
  zrangebyscore(key, min, max).
111
- each {|member| zrem(key, member)}.
111
+ each { |member| zrem(key, member) }.
112
112
  size
113
113
  end
114
114
 
115
- def zrevrangebyscore(key, max, min, options={})
115
+ def zrevrangebyscore(key, max, min, options = {})
116
116
  assert_range_args(min, max)
117
117
 
118
118
  with_zset_at(key) do |zset|
@@ -125,7 +125,7 @@ class MockRedis
125
125
  end
126
126
 
127
127
  def zrevrank(key, member)
128
- with_zset_at(key) {|z| z.sorted_members.reverse.index(member.to_s) }
128
+ with_zset_at(key) { |z| z.sorted_members.reverse.index(member.to_s) }
129
129
  end
130
130
 
131
131
  def zscore(key, member)
@@ -135,7 +135,7 @@ class MockRedis
135
135
  end
136
136
  end
137
137
 
138
- def zunionstore(destination, keys, options={})
138
+ def zunionstore(destination, keys, options = {})
139
139
  assert_has_args(keys, 'zunionstore')
140
140
 
141
141
  data[destination] = combine_weighted_zsets(keys, options, :union)
@@ -143,13 +143,14 @@ class MockRedis
143
143
  end
144
144
 
145
145
  private
146
+
146
147
  def apply_limit(collection, limit)
147
148
  if limit
148
149
  if limit.is_a?(Array) && limit.length == 2
149
150
  offset, count = limit
150
151
  collection.drop(offset).take(count)
151
152
  else
152
- raise Redis::CommandError, "ERR syntax error"
153
+ raise Redis::CommandError, 'ERR syntax error'
153
154
  end
154
155
  else
155
156
  collection
@@ -157,7 +158,7 @@ class MockRedis
157
158
  end
158
159
 
159
160
  def to_response(score_member_pairs, options)
160
- score_member_pairs.map do |(score,member)|
161
+ score_member_pairs.map do |(score, member)|
161
162
  if options[:with_scores] || options[:withscores]
162
163
  [member, score.to_f]
163
164
  else
@@ -169,18 +170,18 @@ class MockRedis
169
170
  def combine_weighted_zsets(keys, options, how)
170
171
  weights = options.fetch(:weights, keys.map { 1 })
171
172
  if weights.length != keys.length
172
- raise Redis::CommandError, "ERR syntax error"
173
+ raise Redis::CommandError, 'ERR syntax error'
173
174
  end
174
175
 
175
176
  aggregator = case options.fetch(:aggregate, :sum).to_s.downcase.to_sym
176
177
  when :sum
177
- proc {|a,b| [a,b].compact.reduce(&:+)}
178
+ proc { |a, b| [a, b].compact.reduce(&:+) }
178
179
  when :min
179
- proc {|a,b| [a,b].compact.min}
180
+ proc { |a, b| [a, b].compact.min }
180
181
  when :max
181
- proc {|a,b| [a,b].compact.max}
182
+ proc { |a, b| [a, b].compact.max }
182
183
  else
183
- raise Redis::CommandError, "ERR syntax error"
184
+ raise Redis::CommandError, 'ERR syntax error'
184
185
  end
185
186
 
186
187
  with_zsets_at(*keys) do |*zsets|
@@ -192,11 +193,10 @@ class MockRedis
192
193
  za.send(how, zb, &aggregator)
193
194
  end
194
195
  end
195
-
196
196
  end
197
197
 
198
198
  def with_zset_at(key, &blk)
199
- with_thing_at(key, :assert_zsety, proc {Zset.new}, &blk)
199
+ with_thing_at(key, :assert_zsety, proc { Zset.new }, &blk)
200
200
  end
201
201
 
202
202
  def with_zsets_at(*keys, &blk)
@@ -212,13 +212,13 @@ class MockRedis
212
212
  end
213
213
 
214
214
  def zsety?(key)
215
- data[key].nil? || data[key].kind_of?(Zset)
215
+ data[key].nil? || data[key].is_a?(Zset)
216
216
  end
217
217
 
218
218
  def assert_zsety(key)
219
219
  unless zsety?(key)
220
220
  raise Redis::CommandError,
221
- "WRONGTYPE Operation against a key holding the wrong kind of value"
221
+ 'WRONGTYPE Operation against a key holding the wrong kind of value'
222
222
  end
223
223
  end
224
224
 
@@ -227,7 +227,7 @@ class MockRedis
227
227
  !!Float(x) rescue false
228
228
  end
229
229
 
230
- def assert_scorey(value, message = "ERR value is not a valid float")
230
+ def assert_scorey(value, message = 'ERR value is not a valid float')
231
231
  return if value =~ /\(?(\-|\+)inf/
232
232
 
233
233
  value = $1 if value.to_s.match(/\((.*)/)
data/spec/cloning_spec.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "MockRedis#clone" do
3
+ describe 'MockRedis#clone' do
4
4
  before do
5
5
  @mock = MockRedis.new
6
6
  end
7
7
 
8
- context "the stored data" do
8
+ context 'the stored data' do
9
9
  before do
10
10
  @mock.set('foo', 'bar')
11
11
  @mock.hset('foohash', 'bar', 'baz')
@@ -16,60 +16,60 @@ describe "MockRedis#clone" do
16
16
  @clone = @mock.clone
17
17
  end
18
18
 
19
- it "copies the stored data to the clone" do
19
+ it 'copies the stored data to the clone' do
20
20
  @clone.get('foo').should == 'bar'
21
21
  end
22
22
 
23
- it "performs a deep copy (string values)" do
23
+ it 'performs a deep copy (string values)' do
24
24
  @mock.del('foo')
25
25
  @clone.get('foo').should == 'bar'
26
26
  end
27
27
 
28
- it "performs a deep copy (list values)" do
28
+ it 'performs a deep copy (list values)' do
29
29
  @mock.lpop('foolist')
30
30
  @clone.lrange('foolist', 0, 1).should == ['bar']
31
31
  end
32
32
 
33
- it "performs a deep copy (hash values)" do
33
+ it 'performs a deep copy (hash values)' do
34
34
  @mock.hset('foohash', 'bar', 'quux')
35
- @clone.hgetall('foohash').should == {'bar' => 'baz'}
35
+ @clone.hgetall('foohash').should == { 'bar' => 'baz' }
36
36
  end
37
37
 
38
- it "performs a deep copy (set values)" do
38
+ it 'performs a deep copy (set values)' do
39
39
  @mock.srem('fooset', 'bar')
40
40
  @clone.smembers('fooset').should == ['bar']
41
41
  end
42
42
 
43
- it "performs a deep copy (zset values)" do
43
+ it 'performs a deep copy (zset values)' do
44
44
  @mock.zadd('foozset', 2, 'bar')
45
45
  @clone.zscore('foozset', 'bar').should == 1.0
46
46
  end
47
47
  end
48
48
 
49
- context "expiration times" do
49
+ context 'expiration times' do
50
50
  before do
51
51
  @mock.set('foo', 1)
52
- @mock.expire('foo', 60026)
52
+ @mock.expire('foo', 60_026)
53
53
 
54
54
  @clone = @mock.clone
55
55
  end
56
56
 
57
- it "copies the expiration times" do
57
+ it 'copies the expiration times' do
58
58
  @clone.ttl('foo').should > 0
59
59
  end
60
60
 
61
- it "deep-copies the expiration times" do
61
+ it 'deep-copies the expiration times' do
62
62
  @mock.persist('foo')
63
63
  @clone.ttl('foo').should > 0
64
64
  end
65
65
 
66
- it "deep-copies the expiration times" do
66
+ it 'deep-copies the expiration times' do
67
67
  @clone.persist('foo')
68
68
  @mock.ttl('foo').should > 0
69
69
  end
70
70
  end
71
71
 
72
- context "transactional info" do
72
+ context 'transactional info' do
73
73
  before do
74
74
  @mock.multi
75
75
  @mock.incr('foo')
@@ -79,18 +79,17 @@ describe "MockRedis#clone" do
79
79
  @clone = @mock.clone
80
80
  end
81
81
 
82
- it "makes sure the clone is in a transaction" do
82
+ it 'makes sure the clone is in a transaction' do
83
83
  lambda do
84
84
  @clone.exec
85
85
  end.should_not raise_error
86
86
  end
87
87
 
88
- it "deep-copies the queued commands" do
88
+ it 'deep-copies the queued commands' do
89
89
  @clone.incrby('foo', 8)
90
90
  @clone.exec.should == [1, 3, 7, 15]
91
91
 
92
92
  @mock.exec.should == [1, 3, 7]
93
93
  end
94
94
  end
95
-
96
95
  end
@@ -3,22 +3,22 @@ require 'spec_helper'
3
3
  describe '#append(key, value)' do
4
4
  before { @key = 'mock-redis-test:append' }
5
5
 
6
- it "returns the new length of the string" do
6
+ it 'returns the new length of the string' do
7
7
  @redises.set(@key, 'porkchop')
8
8
  @redises.append(@key, 'sandwiches').should == 18
9
9
  end
10
10
 
11
- it "appends value to the previously-stored value" do
11
+ it 'appends value to the previously-stored value' do
12
12
  @redises.set(@key, 'porkchop')
13
13
  @redises.append(@key, 'sandwiches')
14
14
 
15
15
  @redises.get(@key).should == 'porkchopsandwiches'
16
16
  end
17
17
 
18
- it "treats a missing key as an empty string" do
18
+ it 'treats a missing key as an empty string' do
19
19
  @redises.append(@key, 'foo')
20
20
  @redises.get(@key).should == 'foo'
21
21
  end
22
22
 
23
- it_should_behave_like "a string-only command"
23
+ it_should_behave_like 'a string-only command'
24
24
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#auth(password) [mock only]" do
3
+ describe '#auth(password) [mock only]' do
4
4
  it "just returns 'OK'" do
5
5
  @redises.mock.auth('foo').should == 'OK'
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#bgrewriteaof [mock only]" do
4
- it "just returns a canned string" do
3
+ describe '#bgrewriteaof [mock only]' do
4
+ it 'just returns a canned string' do
5
5
  @redises.mock.bgrewriteaof.should =~ /append/
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#bgsave [mock only]" do
4
- it "just returns a canned string" do
3
+ describe '#bgsave [mock only]' do
4
+ it 'just returns a canned string' do
5
5
  @redises.mock.bgsave.should =~ /saving/
6
6
  end
7
7
  end
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#bitcount(key [, start, end ])" do
3
+ describe '#bitcount(key [, start, end ])' do
4
4
  before do
5
5
  @key = 'mock-redis-test:bitcount'
6
- @redises.set(@key, "foobar")
6
+ @redises.set(@key, 'foobar')
7
7
  end
8
8
 
9
9
  it 'gets the number of set bits from the key' do
@@ -21,5 +21,5 @@ describe "#bitcount(key [, start, end ])" do
21
21
  @redises.bitcount('mock-redis-test:not-found').should == 0
22
22
  end
23
23
 
24
- it_should_behave_like "a string-only command"
24
+ it_should_behave_like 'a string-only command'
25
25
  end