mock_redis 0.14.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -3,60 +3,60 @@ require 'spec_helper'
3
3
  describe '#info [mock only]' do
4
4
  let(:redis) { @redises.mock }
5
5
 
6
- it "responds with a config hash" do
6
+ it 'responds with a config hash' do
7
7
  redis.info.should be_a(Hash)
8
8
  end
9
9
 
10
- it "gets default set of info" do
10
+ it 'gets default set of info' do
11
11
  info = redis.info
12
- info["arch_bits"].should be_a(String)
13
- info["connected_clients"].should be_a(String)
14
- info["aof_rewrite_scheduled"].should be_a(String)
15
- info["used_cpu_sys"].should be_a(String)
12
+ info['arch_bits'].should be_a(String)
13
+ info['connected_clients'].should be_a(String)
14
+ info['aof_rewrite_scheduled'].should be_a(String)
15
+ info['used_cpu_sys'].should be_a(String)
16
16
  end
17
17
 
18
- it "gets all info" do
18
+ it 'gets all info' do
19
19
  info = redis.info(:all)
20
- info["arch_bits"].should be_a(String)
21
- info["connected_clients"].should be_a(String)
22
- info["aof_rewrite_scheduled"].should be_a(String)
23
- info["used_cpu_sys"].should be_a(String)
24
- info["cmdstat_slowlog"].should be_a(String)
20
+ info['arch_bits'].should be_a(String)
21
+ info['connected_clients'].should be_a(String)
22
+ info['aof_rewrite_scheduled'].should be_a(String)
23
+ info['used_cpu_sys'].should be_a(String)
24
+ info['cmdstat_slowlog'].should be_a(String)
25
25
  end
26
26
 
27
- it "gets server info" do
28
- redis.info(:server)["arch_bits"].should be_a(String)
27
+ it 'gets server info' do
28
+ redis.info(:server)['arch_bits'].should be_a(String)
29
29
  end
30
30
 
31
- it "gets clients info" do
32
- redis.info(:clients)["connected_clients"].should be_a(String)
31
+ it 'gets clients info' do
32
+ redis.info(:clients)['connected_clients'].should be_a(String)
33
33
  end
34
34
 
35
- it "gets memory info" do
36
- redis.info(:memory)["used_memory"].should be_a(String)
35
+ it 'gets memory info' do
36
+ redis.info(:memory)['used_memory'].should be_a(String)
37
37
  end
38
38
 
39
- it "gets persistence info" do
40
- redis.info(:persistence)["aof_rewrite_scheduled"].should be_a(String)
39
+ it 'gets persistence info' do
40
+ redis.info(:persistence)['aof_rewrite_scheduled'].should be_a(String)
41
41
  end
42
42
 
43
- it "gets stats info" do
44
- redis.info(:stats)["keyspace_hits"].should be_a(String)
43
+ it 'gets stats info' do
44
+ redis.info(:stats)['keyspace_hits'].should be_a(String)
45
45
  end
46
46
 
47
- it "gets replication info" do
48
- redis.info(:replication)["role"].should be_a(String)
47
+ it 'gets replication info' do
48
+ redis.info(:replication)['role'].should be_a(String)
49
49
  end
50
50
 
51
- it "gets cpu info" do
52
- redis.info(:cpu)["used_cpu_sys"].should be_a(String)
51
+ it 'gets cpu info' do
52
+ redis.info(:cpu)['used_cpu_sys'].should be_a(String)
53
53
  end
54
54
 
55
- it "gets keyspace info" do
56
- redis.info(:keyspace)["db0"].should be_a(String)
55
+ it 'gets keyspace info' do
56
+ redis.info(:keyspace)['db0'].should be_a(String)
57
57
  end
58
58
 
59
- it "gets commandstats info" do
60
- redis.info(:commandstats)["sunionstore"]["usec"].should be_a(String)
59
+ it 'gets commandstats info' do
60
+ redis.info(:commandstats)['sunionstore']['usec'].should be_a(String)
61
61
  end
62
62
  end
@@ -1,48 +1,47 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe '#keys()' do
4
-
5
- it "returns [] when no keys are found (no regex characters)" do
6
- @redises.keys("mock-redis-test:29016").should == []
4
+ it 'returns [] when no keys are found (no regex characters)' do
5
+ @redises.keys('mock-redis-test:29016').should == []
7
6
  end
8
7
 
9
- it "returns [] when no keys are found (some regex characters)" do
10
- @redises.keys("mock-redis-test:29016*").should == []
8
+ it 'returns [] when no keys are found (some regex characters)' do
9
+ @redises.keys('mock-redis-test:29016*').should == []
11
10
  end
12
11
 
13
- describe "with pattern matching" do
12
+ describe 'with pattern matching' do
14
13
  before do
15
- @redises.set("mock-redis-test:key", 0)
16
- @redises.set("mock-redis-test:key1", 1)
17
- @redises.set("mock-redis-test:key2", 2)
18
- @redises.set("mock-redis-test:key3", 3)
19
- @redises.set("mock-redis-test:key10", 10)
20
- @redises.set("mock-redis-test:key20", 20)
21
- @redises.set("mock-redis-test:key30", 30)
22
-
23
- @redises.set("mock-redis-test:regexp-key(1|22)", 40)
24
- @redises.set("mock-redis-test:regexp-key3+", 40)
25
- @redises.set("mock-redis-test:regexp-key33", 40)
26
- @redises.set("mock-redis-test:regexp-key4a", 40)
27
- @redises.set("mock-redis-test:regexp-key4-", 40)
28
- @redises.set("mock-redis-test:regexp-key4b", 40)
29
- @redises.set("mock-redis-test:regexp-key4c", 40)
30
-
31
- @redises.set("mock-redis-test:special-key?", 'true')
32
- @redises.set("mock-redis-test:special-key*", 'true')
14
+ @redises.set('mock-redis-test:key', 0)
15
+ @redises.set('mock-redis-test:key1', 1)
16
+ @redises.set('mock-redis-test:key2', 2)
17
+ @redises.set('mock-redis-test:key3', 3)
18
+ @redises.set('mock-redis-test:key10', 10)
19
+ @redises.set('mock-redis-test:key20', 20)
20
+ @redises.set('mock-redis-test:key30', 30)
21
+
22
+ @redises.set('mock-redis-test:regexp-key(1|22)', 40)
23
+ @redises.set('mock-redis-test:regexp-key3+', 40)
24
+ @redises.set('mock-redis-test:regexp-key33', 40)
25
+ @redises.set('mock-redis-test:regexp-key4a', 40)
26
+ @redises.set('mock-redis-test:regexp-key4-', 40)
27
+ @redises.set('mock-redis-test:regexp-key4b', 40)
28
+ @redises.set('mock-redis-test:regexp-key4c', 40)
29
+
30
+ @redises.set('mock-redis-test:special-key?', 'true')
31
+ @redises.set('mock-redis-test:special-key*', 'true')
33
32
  end
34
33
 
35
- describe "the ? character" do
36
- it "is treated as a single character (at the end of the pattern)" do
37
- @redises.keys("mock-redis-test:key?").sort.should == [
34
+ describe 'the ? character' do
35
+ it 'is treated as a single character (at the end of the pattern)' do
36
+ @redises.keys('mock-redis-test:key?').sort.should == [
38
37
  'mock-redis-test:key1',
39
38
  'mock-redis-test:key2',
40
39
  'mock-redis-test:key3',
41
40
  ]
42
41
  end
43
42
 
44
- it "is treated as a single character (in the middle of the pattern)" do
45
- @redises.keys("mock-redis-test:key?0").sort.should == [
43
+ it 'is treated as a single character (in the middle of the pattern)' do
44
+ @redises.keys('mock-redis-test:key?0').sort.should == [
46
45
  'mock-redis-test:key10',
47
46
  'mock-redis-test:key20',
48
47
  'mock-redis-test:key30',
@@ -51,14 +50,14 @@ describe '#keys()' do
51
50
 
52
51
  it "treats \? as a literal ?" do
53
52
  @redises.keys('mock-redis-test:special-key\?').sort.should == [
54
- 'mock-redis-test:special-key?'
53
+ 'mock-redis-test:special-key?',
55
54
  ]
56
55
  end
57
56
  end
58
57
 
59
- describe "the * character" do
60
- it "is treated as 0 or more characters" do
61
- @redises.keys("mock-redis-test:key*").sort.should == [
58
+ describe 'the * character' do
59
+ it 'is treated as 0 or more characters' do
60
+ @redises.keys('mock-redis-test:key*').sort.should == [
62
61
  'mock-redis-test:key',
63
62
  'mock-redis-test:key1',
64
63
  'mock-redis-test:key10',
@@ -71,13 +70,13 @@ describe '#keys()' do
71
70
 
72
71
  it "treats \* as a literal *" do
73
72
  @redises.keys('mock-redis-test:special-key\*').sort.should == [
74
- 'mock-redis-test:special-key*'
73
+ 'mock-redis-test:special-key*',
75
74
  ]
76
75
  end
77
76
  end
78
77
 
79
- describe "character classes ([abcde])" do
80
- it "matches any one of those characters" do
78
+ describe 'character classes ([abcde])' do
79
+ it 'matches any one of those characters' do
81
80
  @redises.keys('mock-redis-test:key[12]').sort.should == [
82
81
  'mock-redis-test:key1',
83
82
  'mock-redis-test:key2',
@@ -85,23 +84,23 @@ describe '#keys()' do
85
84
  end
86
85
  end
87
86
 
88
- describe "the | character" do
87
+ describe 'the | character' do
89
88
  it "is treated as literal (not 'or')" do
90
89
  @redises.keys('mock-redis-test:regexp-key(1|22)').sort.should == [
91
- 'mock-redis-test:regexp-key(1|22)'
90
+ 'mock-redis-test:regexp-key(1|22)',
92
91
  ]
93
92
  end
94
93
  end
95
94
 
96
- describe "the + character" do
95
+ describe 'the + character' do
97
96
  it "is treated as literal (not 'one or more' quantifier)" do
98
97
  @redises.keys('mock-redis-test:regexp-key3+').sort.should == [
99
- 'mock-redis-test:regexp-key3+'
98
+ 'mock-redis-test:regexp-key3+',
100
99
  ]
101
100
  end
102
101
  end
103
102
 
104
- describe "character classes ([a-c])" do
103
+ describe 'character classes ([a-c])' do
105
104
  it "specifies a range which matches any lowercase letter from \"a\" to \"c\"" do
106
105
  @redises.keys('mock-redis-test:regexp-key4[a-c]').sort.should == [
107
106
  'mock-redis-test:regexp-key4a',
@@ -111,8 +110,8 @@ describe '#keys()' do
111
110
  end
112
111
  end
113
112
 
114
- describe "combining metacharacters" do
115
- it "works with different metacharacters simultaneously" do
113
+ describe 'combining metacharacters' do
114
+ it 'works with different metacharacters simultaneously' do
116
115
  @redises.keys('mock-redis-test:k*[12]?').sort.should == [
117
116
  'mock-redis-test:key10',
118
117
  'mock-redis-test:key20',
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#lastsave [mock only]" do
3
+ describe '#lastsave [mock only]' do
4
4
  # can't test against both since it's timing-dependent
5
- it "returns a Unix time" do
5
+ it 'returns a Unix time' do
6
6
  @redises.mock.lastsave.to_s.should =~ /^\d+$/
7
7
  end
8
8
  end
@@ -3,47 +3,47 @@ require 'spec_helper'
3
3
  describe '#lindex(key, index)' do
4
4
  before { @key = 'mock-redis-test:69312' }
5
5
 
6
- it "gets an element from the list by its index" do
6
+ it 'gets an element from the list by its index' do
7
7
  @redises.lpush(@key, 20)
8
8
  @redises.lpush(@key, 10)
9
9
 
10
- @redises.lindex(@key, 0).should == "10"
11
- @redises.lindex(@key, 1).should == "20"
10
+ @redises.lindex(@key, 0).should == '10'
11
+ @redises.lindex(@key, 1).should == '20'
12
12
  end
13
13
 
14
- it "treats negative indices as coming from the right" do
14
+ it 'treats negative indices as coming from the right' do
15
15
  @redises.lpush(@key, 20)
16
16
  @redises.lpush(@key, 10)
17
17
 
18
- @redises.lindex(@key, -1).should == "20"
19
- @redises.lindex(@key, -2).should == "10"
18
+ @redises.lindex(@key, -1).should == '20'
19
+ @redises.lindex(@key, -2).should == '10'
20
20
  end
21
21
 
22
- it "gets an element from the list by its index when index is a string" do
22
+ it 'gets an element from the list by its index when index is a string' do
23
23
  @redises.lpush(@key, 20)
24
24
  @redises.lpush(@key, 10)
25
25
 
26
- @redises.lindex(@key, '0').should == "10"
27
- @redises.lindex(@key, '1').should == "20"
28
- @redises.lindex(@key, '-1').should == "20"
29
- @redises.lindex(@key, '-2').should == "10"
26
+ @redises.lindex(@key, '0').should == '10'
27
+ @redises.lindex(@key, '1').should == '20'
28
+ @redises.lindex(@key, '-1').should == '20'
29
+ @redises.lindex(@key, '-2').should == '10'
30
30
  end
31
31
 
32
- it "returns nil if the index is too large (and positive)" do
32
+ it 'returns nil if the index is too large (and positive)' do
33
33
  @redises.lpush(@key, 20)
34
34
 
35
35
  @redises.lindex(@key, 100).should be_nil
36
36
  end
37
37
 
38
- it "returns nil if the index is too large (and negative)" do
38
+ it 'returns nil if the index is too large (and negative)' do
39
39
  @redises.lpush(@key, 20)
40
40
 
41
41
  @redises.lindex(@key, -100).should be_nil
42
42
  end
43
43
 
44
- it "returns nil for nonexistent values" do
44
+ it 'returns nil for nonexistent values' do
45
45
  @redises.lindex(@key, 0).should be_nil
46
46
  end
47
47
 
48
- it_should_behave_like "a list-only command"
48
+ it_should_behave_like 'a list-only command'
49
49
  end
@@ -1,26 +1,26 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#linsert(key, :before|:after, pivot, value)" do
3
+ describe '#linsert(key, :before|:after, pivot, value)' do
4
4
  before { @key = 'mock-redis-test:48733' }
5
5
 
6
- it "returns the new size of the list when the pivot is found" do
6
+ it 'returns the new size of the list when the pivot is found' do
7
7
  @redises.lpush(@key, 'X')
8
8
 
9
9
  @redises.linsert(@key, :before, 'X', 'Y').should == 2
10
10
  @redises.lpushx(@key, 'X').should == 3
11
11
  end
12
12
 
13
- it "does nothing when run against a nonexistent key" do
13
+ it 'does nothing when run against a nonexistent key' do
14
14
  @redises.linsert(@key, :before, 1, 2).should == 0
15
15
  @redises.get(@key).should be_nil
16
16
  end
17
17
 
18
- it "returns -1 if the pivot is not found" do
18
+ it 'returns -1 if the pivot is not found' do
19
19
  @redises.lpush(@key, 1)
20
20
  @redises.linsert(@key, :after, 'X', 'Y').should == -1
21
21
  end
22
22
 
23
- it "inserts elements before the pivot when given :before as position" do
23
+ it 'inserts elements before the pivot when given :before as position' do
24
24
  @redises.lpush(@key, 'bert')
25
25
  @redises.linsert(@key, :before, 'bert', 'ernie')
26
26
 
@@ -36,33 +36,33 @@ describe "#linsert(key, :before|:after, pivot, value)" do
36
36
  @redises.lindex(@key, 1).should == 'bert'
37
37
  end
38
38
 
39
- it "inserts elements after the pivot when given :after as position" do
39
+ it 'inserts elements after the pivot when given :after as position' do
40
40
  @redises.lpush(@key, 'bert')
41
41
  @redises.linsert(@key, :after, 'bert', 'ernie')
42
-
42
+
43
43
  @redises.lindex(@key, 0).should == 'bert'
44
44
  @redises.lindex(@key, 1).should == 'ernie'
45
45
  end
46
-
46
+
47
47
  it "inserts elements after the pivot when given 'after' as position" do
48
48
  @redises.lpush(@key, 'bert')
49
49
  @redises.linsert(@key, 'after', 'bert', 'ernie')
50
-
50
+
51
51
  @redises.lindex(@key, 0).should == 'bert'
52
52
  @redises.lindex(@key, 1).should == 'ernie'
53
53
  end
54
54
 
55
- it "raises an error when given a position that is neither before nor after" do
55
+ it 'raises an error when given a position that is neither before nor after' do
56
56
  lambda do
57
57
  @redises.linsert(@key, :near, 1, 2)
58
58
  end.should raise_error(RuntimeError)
59
59
  end
60
60
 
61
- it "stores values as strings" do
61
+ it 'stores values as strings' do
62
62
  @redises.lpush(@key, 1)
63
63
  @redises.linsert(@key, :before, 1, 2)
64
- @redises.lindex(@key, 0).should == "2"
64
+ @redises.lindex(@key, 0).should == '2'
65
65
  end
66
66
 
67
- it_should_behave_like "a list-only command"
67
+ it_should_behave_like 'a list-only command'
68
68
  end
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "#llen(key)" do
3
+ describe '#llen(key)' do
4
4
  before { @key = 'mock-redis-test:78407' }
5
5
 
6
- it "returns 0 for a nonexistent key" do
6
+ it 'returns 0 for a nonexistent key' do
7
7
  @redises.llen(@key).should == 0
8
8
  end
9
9
 
10
- it "returns the length of the list" do
10
+ it 'returns the length of the list' do
11
11
  5.times { @redises.lpush(@key, 'X') }
12
12
  @redises.llen(@key).should == 5
13
13
  end
14
14
 
15
- it_should_behave_like "a list-only command"
15
+ it_should_behave_like 'a list-only command'
16
16
  end
@@ -3,32 +3,32 @@ require 'spec_helper'
3
3
  describe '#lpop(key)' do
4
4
  before { @key = 'mock-redis-test:65374' }
5
5
 
6
- it "returns and removes the first element of a list" do
6
+ it 'returns and removes the first element of a list' do
7
7
  @redises.lpush(@key, 1)
8
8
  @redises.lpush(@key, 2)
9
9
 
10
- @redises.lpop(@key).should == "2"
10
+ @redises.lpop(@key).should == '2'
11
11
 
12
12
  @redises.llen(@key).should == 1
13
13
  end
14
14
 
15
- it "returns nil if the list is empty" do
15
+ it 'returns nil if the list is empty' do
16
16
  @redises.lpush(@key, 'foo')
17
17
  @redises.lpop(@key)
18
18
 
19
19
  @redises.lpop(@key).should be_nil
20
20
  end
21
21
 
22
- it "returns nil for nonexistent values" do
22
+ it 'returns nil for nonexistent values' do
23
23
  @redises.lpop(@key).should be_nil
24
24
  end
25
25
 
26
- it "removes empty lists" do
26
+ it 'removes empty lists' do
27
27
  @redises.lpush(@key, 'foo')
28
28
  @redises.lpop(@key)
29
29
 
30
30
  @redises.get(@key).should be_nil
31
31
  end
32
32
 
33
- it_should_behave_like "a list-only command"
33
+ it_should_behave_like 'a list-only command'
34
34
  end