mock_redis 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.overcommit.yml +2 -0
  3. data/.rspec +1 -1
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +1 -1
  6. data/lib/mock_redis/hash_methods.rb +6 -2
  7. data/lib/mock_redis/version.rb +1 -1
  8. data/spec/commands/decr_spec.rb +1 -1
  9. data/spec/commands/decrby_spec.rb +1 -1
  10. data/spec/commands/expire_spec.rb +1 -1
  11. data/spec/commands/expireat_spec.rb +1 -1
  12. data/spec/commands/future_spec.rb +1 -1
  13. data/spec/commands/hincrby_spec.rb +2 -2
  14. data/spec/commands/hincrbyfloat_spec.rb +2 -2
  15. data/spec/commands/hmget_spec.rb +5 -1
  16. data/spec/commands/hmset_spec.rb +2 -2
  17. data/spec/commands/incr_spec.rb +1 -1
  18. data/spec/commands/incrby_spec.rb +2 -2
  19. data/spec/commands/incrbyfloat_spec.rb +2 -2
  20. data/spec/commands/linsert_spec.rb +1 -1
  21. data/spec/commands/lrem_spec.rb +1 -1
  22. data/spec/commands/lset_spec.rb +2 -2
  23. data/spec/commands/mapped_hmget_spec.rb +5 -1
  24. data/spec/commands/mget_spec.rb +1 -1
  25. data/spec/commands/mset_spec.rb +2 -2
  26. data/spec/commands/msetnx_spec.rb +2 -2
  27. data/spec/commands/pexpire_spec.rb +1 -1
  28. data/spec/commands/pexpireat_spec.rb +1 -1
  29. data/spec/commands/rename_spec.rb +1 -1
  30. data/spec/commands/renamenx_spec.rb +1 -1
  31. data/spec/commands/rpoplpush_spec.rb +1 -1
  32. data/spec/commands/sdiff_spec.rb +3 -3
  33. data/spec/commands/sdiffstore_spec.rb +3 -3
  34. data/spec/commands/sinter_spec.rb +3 -3
  35. data/spec/commands/sinterstore_spec.rb +3 -3
  36. data/spec/commands/sunion_spec.rb +3 -3
  37. data/spec/commands/sunionstore_spec.rb +3 -3
  38. data/spec/commands/zinterstore_spec.rb +3 -3
  39. data/spec/commands/zrangebyscore_spec.rb +1 -1
  40. data/spec/commands/zrevrangebyscore_spec.rb +1 -1
  41. data/spec/commands/zunionstore_spec.rb +3 -3
  42. data/spec/transactions_spec.rb +4 -4
  43. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01d1bfd5cf966db9fd2883757cb12f2c59f09d57
4
- data.tar.gz: 80260a25e033a419eac875729b5e04be332b819f
3
+ metadata.gz: 876d2ece09db22d09c916764951be801e22979ba
4
+ data.tar.gz: 7080cc47123cfdfff6716d8246485986186382b7
5
5
  SHA512:
6
- metadata.gz: 33c9fde7412bf24e0180010c048fb80265e98b620d445765377f590286240063b5fd018cc6398d989f74084eccfaebe5c4333ad8f51db8af4c2dab9eb7d04136
7
- data.tar.gz: 25739a7c7e6ec24ccc0079966116c9e2c6bf85011da0b17e4a308407ce1d44332416a41258affeb86855239637175c1d593d949120b4b620d0cb14e576539c10
6
+ metadata.gz: 1ff7abec227e9fdbc31cbf9b5cf28c9e568003495b781c0e82f9c8ded4bd215e038996d5f134f1b13ef1478c476fa1457b00596d5246d0e2372926e497ac1c5a
7
+ data.tar.gz: 8a0dd66ef2638ae20b0ffbc9fd6643a7153e094f9b6c76f499547d120225dd7caa9c668122598b43ef6ab98378079d0a2675137a42afab7702ce830c3ad1897f
@@ -1,3 +1,5 @@
1
+ gemfile: Gemfile
2
+
1
3
  PreCommit:
2
4
  BundleCheck:
3
5
  enabled: true
data/.rspec CHANGED
@@ -1 +1 @@
1
- -c
1
+ --color
@@ -1,5 +1,9 @@
1
1
  # MockRedis Changelog
2
2
 
3
+ ### 0.15.1
4
+
5
+ * Fix `hmget` and `mapped_hmget` to allow passing of an array of keys
6
+
3
7
  ### 0.15.0
4
8
 
5
9
  * Add support for the `time` method
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'http://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  # Run all pre-commit hooks via Overcommit during CI runs
7
- gem 'overcommit', '0.26.0'
7
+ gem 'overcommit', '0.27.0'
8
8
 
9
9
  # Pin tool versions (which are executed by Overcommit) for Travis builds
10
10
  gem 'rubocop', '0.32.1'
@@ -75,12 +75,16 @@ class MockRedis
75
75
 
76
76
  def hmget(key, *fields)
77
77
  assert_has_args(fields, 'hmget')
78
- fields.map { |f| hget(key, f) }
78
+ fields.flatten.map { |f| hget(key, f) }
79
79
  end
80
80
 
81
81
  def mapped_hmget(key, *fields)
82
82
  reply = hmget(key, *fields)
83
- Hash[*fields.zip(reply).flatten]
83
+ if reply.is_a?(Array)
84
+ Hash[fields.zip(reply)]
85
+ else
86
+ reply
87
+ end
84
88
  end
85
89
 
86
90
  def hmset(key, *kvpairs)
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  class MockRedis
3
- VERSION = '0.15.0'
3
+ VERSION = '0.15.1'
4
4
  end
@@ -27,7 +27,7 @@ describe '#decr(key)' do
27
27
  @redises.set(@key, 'minus one')
28
28
  lambda do
29
29
  @redises.decr(@key)
30
- end.should raise_error(RuntimeError)
30
+ end.should raise_error(Redis::CommandError)
31
31
  end
32
32
 
33
33
  it_should_behave_like 'a string-only command'
@@ -27,7 +27,7 @@ describe '#decrby(key, decrement)' do
27
27
  @redises.set(@key, 'one')
28
28
  lambda do
29
29
  @redises.decrby(@key, 1)
30
- end.should raise_error(RuntimeError)
30
+ end.should raise_error(Redis::CommandError)
31
31
  end
32
32
 
33
33
  it_should_behave_like 'a string-only command'
@@ -22,7 +22,7 @@ describe '#expire(key, seconds)' do
22
22
  it 'raises an error if seconds is bogus' do
23
23
  lambda do
24
24
  @redises.expireat(@key, 'a couple minutes or so')
25
- end.should raise_error(RuntimeError)
25
+ end.should raise_error(Redis::CommandError)
26
26
  end
27
27
 
28
28
  it 'stringifies key' do
@@ -22,7 +22,7 @@ describe '#expireat(key, timestamp)' do
22
22
  it "raises an error if you don't give it a Unix timestamp" do
23
23
  lambda do
24
24
  @redises.expireat(@key, Time.now) # oops, forgot .to_i
25
- end.should raise_error(RuntimeError)
25
+ end.should raise_error(Redis::CommandError)
26
26
  end
27
27
 
28
28
  context '[mock only]' do
@@ -10,7 +10,7 @@ describe MockRedis::Future do
10
10
  end
11
11
 
12
12
  it 'raises an error if the value is requested before the result is set' do
13
- expect { @future.value }.to raise_error(RuntimeError)
13
+ expect { @future.value }.to raise_error(MockRedis::FutureNotReady)
14
14
  end
15
15
 
16
16
  it 'returns the value after the result has been set' do
@@ -45,13 +45,13 @@ describe '#hincrby(key, field, increment)' do
45
45
  @redises.hset(@key, @field, 'one')
46
46
  lambda do
47
47
  @redises.hincrby(@key, @field, 1)
48
- end.should raise_error(RuntimeError)
48
+ end.should raise_error(Redis::CommandError)
49
49
  end
50
50
 
51
51
  it 'raises an error if the delta does not look like an integer' do
52
52
  lambda do
53
53
  @redises.hincrby(@key, @field, 'foo')
54
- end.should raise_error(RuntimeError)
54
+ end.should raise_error(Redis::CommandError)
55
55
  end
56
56
 
57
57
  it_should_behave_like 'a hash-only command'
@@ -45,13 +45,13 @@ describe '#hincrbyfloat(key, field, increment)' do
45
45
  @redises.hset(@key, @field, 'one.two')
46
46
  lambda do
47
47
  @redises.hincrbyfloat(@key, @field, 1)
48
- end.should raise_error(RuntimeError)
48
+ end.should raise_error(Redis::CommandError)
49
49
  end
50
50
 
51
51
  it 'raises an error if the delta does not look like a float' do
52
52
  lambda do
53
53
  @redises.hincrbyfloat(@key, @field, 'foobar.baz')
54
- end.should raise_error(RuntimeError)
54
+ end.should raise_error(Redis::CommandError)
55
55
  end
56
56
 
57
57
  it_should_behave_like 'a hash-only command'
@@ -11,6 +11,10 @@ describe '#hmget(key, field [, field, ...])' do
11
11
  @redises.hmget(@key, 'k1', 'k2').sort.should == %w[v1 v2]
12
12
  end
13
13
 
14
+ it 'treats an array as multiple keys' do
15
+ @redises.hmget(@key, %w[k1 k2]).sort.should == %w[v1 v2]
16
+ end
17
+
14
18
  it 'treats the fielsd as strings' do
15
19
  @redises.hset(@key, 1, 'one')
16
20
  @redises.hset(@key, 2, 'two')
@@ -29,7 +33,7 @@ describe '#hmget(key, field [, field, ...])' do
29
33
  it 'raises an error if given no fields' do
30
34
  lambda do
31
35
  @redises.hmget(@key)
32
- end.should raise_error(RuntimeError)
36
+ end.should raise_error(Redis::CommandError)
33
37
  end
34
38
 
35
39
  it_should_behave_like 'a hash-only command'
@@ -30,13 +30,13 @@ describe '#hmset(key, field, value [, field, value ...])' do
30
30
  it 'raises an error if given no fields or values' do
31
31
  lambda do
32
32
  @redises.hmset(@key)
33
- end.should raise_error(RuntimeError)
33
+ end.should raise_error(Redis::CommandError)
34
34
  end
35
35
 
36
36
  it 'raises an error if given an odd number of fields+values' do
37
37
  lambda do
38
38
  @redises.hmset(@key, 'k1', 1, 'k2')
39
- end.should raise_error(RuntimeError)
39
+ end.should raise_error(Redis::CommandError)
40
40
  end
41
41
 
42
42
  it_should_behave_like 'a hash-only command'
@@ -27,7 +27,7 @@ describe '#incr(key)' do
27
27
  @redises.set(@key, 'one')
28
28
  lambda do
29
29
  @redises.incr(@key)
30
- end.should raise_error(RuntimeError)
30
+ end.should raise_error(Redis::CommandError)
31
31
  end
32
32
 
33
33
  it_should_behave_like 'a string-only command'
@@ -31,13 +31,13 @@ describe '#incrby(key, increment)' do
31
31
  @redises.set(@key, 'one')
32
32
  lambda do
33
33
  @redises.incrby(@key, 1)
34
- end.should raise_error(RuntimeError)
34
+ end.should raise_error(Redis::CommandError)
35
35
  end
36
36
 
37
37
  it 'raises an error if the delta does not look like an integer' do
38
38
  lambda do
39
39
  @redises.incrby(@key, 'foo')
40
- end.should raise_error(RuntimeError)
40
+ end.should raise_error(Redis::CommandError)
41
41
  end
42
42
 
43
43
  it_should_behave_like 'a string-only command'
@@ -31,13 +31,13 @@ describe '#incrbyfloat(key, increment)' do
31
31
  @redises.set(@key, 'one.two')
32
32
  lambda do
33
33
  @redises.incrbyfloat(@key, 1)
34
- end.should raise_error(RuntimeError)
34
+ end.should raise_error(Redis::CommandError)
35
35
  end
36
36
 
37
37
  it 'raises an error if the delta does not look like an float' do
38
38
  lambda do
39
39
  @redises.incrbyfloat(@key, 'foobar.baz')
40
- end.should raise_error(RuntimeError)
40
+ end.should raise_error(Redis::CommandError)
41
41
  end
42
42
 
43
43
  it_should_behave_like 'a string-only command'
@@ -55,7 +55,7 @@ describe '#linsert(key, :before|:after, pivot, value)' do
55
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
- end.should raise_error(RuntimeError)
58
+ end.should raise_error(Redis::CommandError)
59
59
  end
60
60
 
61
61
  it 'stores values as strings' do
@@ -64,7 +64,7 @@ describe '#lrem(key, count, value)' do
64
64
  it 'raises an error if the value does not look like an integer' do
65
65
  lambda do
66
66
  @redises.lrem(@key, 'foo', 'bottles')
67
- end.should raise_error(RuntimeError)
67
+ end.should raise_error(Redis::CommandError)
68
68
  end
69
69
 
70
70
  it 'removes empty lists' do
@@ -30,13 +30,13 @@ describe '#lset(key, index, value)' do
30
30
  it 'raises an exception for nonexistent keys' do
31
31
  lambda do
32
32
  @redises.lset('mock-redis-test:bogus-key', 100, 'value')
33
- end.should raise_error(RuntimeError)
33
+ end.should raise_error(Redis::CommandError)
34
34
  end
35
35
 
36
36
  it 'raises an exception for out-of-range indices' do
37
37
  lambda do
38
38
  @redises.lset(@key, 100, 'value')
39
- end.should raise_error(RuntimeError)
39
+ end.should raise_error(Redis::CommandError)
40
40
  end
41
41
 
42
42
  it_should_behave_like 'a list-only command'
@@ -15,10 +15,14 @@ describe '#mapped_hmget(key, *fields)' do
15
15
  should == { 'k1' => 'v1', 'mock-redis-test:nonesuch' => nil }
16
16
  end
17
17
 
18
+ it 'treats an array as the first key' do
19
+ @redises.mapped_hmget(@key, %w[k1 k2]).should == { %w[k1 k2] => 'v1' }
20
+ end
21
+
18
22
  it 'raises an error if given no fields' do
19
23
  lambda do
20
24
  @redises.mapped_hmget(@key)
21
- end.should raise_error(RuntimeError)
25
+ end.should raise_error(Redis::CommandError)
22
26
  end
23
27
 
24
28
  it_should_behave_like 'a hash-only command'
@@ -29,6 +29,6 @@ describe '#mget(key [, key, ...])' do
29
29
  it 'raises an error if you pass it 0 arguments' do
30
30
  lambda do
31
31
  @redises.mget
32
- end.should raise_error(RuntimeError)
32
+ end.should raise_error(Redis::CommandError)
33
33
  end
34
34
  end
@@ -18,12 +18,12 @@ describe '#mset(key, value [, key, value, ...])' do
18
18
  it 'raises an error if given an odd number of arguments' do
19
19
  lambda do
20
20
  @redises.mset(@key1, 'value1', @key2)
21
- end.should raise_error(RuntimeError)
21
+ end.should raise_error(Redis::CommandError)
22
22
  end
23
23
 
24
24
  it 'raises an error if given 0 arguments' do
25
25
  lambda do
26
26
  @redises.mset
27
- end.should raise_error(RuntimeError)
27
+ end.should raise_error(Redis::CommandError)
28
28
  end
29
29
  end
@@ -29,12 +29,12 @@ describe '#msetnx(key, value [, key, value, ...])' do
29
29
  it 'raises an error if given an odd number of arguments' do
30
30
  lambda do
31
31
  @redises.msetnx(@key1, 'value1', @key2)
32
- end.should raise_error(RuntimeError)
32
+ end.should raise_error(Redis::CommandError)
33
33
  end
34
34
 
35
35
  it 'raises an error if given 0 arguments' do
36
36
  lambda do
37
37
  @redises.msetnx
38
- end.should raise_error(RuntimeError)
38
+ end.should raise_error(Redis::CommandError)
39
39
  end
40
40
  end
@@ -22,7 +22,7 @@ describe '#pexpire(key, ms)' do
22
22
  it 'raises an error if ms is bogus' do
23
23
  lambda do
24
24
  @redises.pexpireat(@key, 'a couple minutes or so')
25
- end.should raise_error(RuntimeError)
25
+ end.should raise_error(Redis::CommandError)
26
26
  end
27
27
 
28
28
  it 'stringifies key' do
@@ -23,7 +23,7 @@ describe '#pexpireat(key, timestamp_ms)' do
23
23
  it "raises an error if you don't give it a Unix timestamp" do
24
24
  lambda do
25
25
  @redises.pexpireat(@key, Time.now) # oops, forgot .to_i
26
- end.should raise_error(RuntimeError)
26
+ end.should raise_error(Redis::CommandError)
27
27
  end
28
28
 
29
29
  context '[mock only]' do
@@ -27,7 +27,7 @@ describe '#rename(key, newkey)' do
27
27
  it 'raises an error when key == newkey' do
28
28
  lambda do
29
29
  @redises.rename(@key, @key)
30
- end.should raise_error(RuntimeError)
30
+ end.should raise_error(Redis::CommandError)
31
31
  end
32
32
 
33
33
  it 'overwrites any existing value at newkey' do
@@ -32,7 +32,7 @@ describe '#renamenx(key, newkey)' do
32
32
  it 'raises an error when key == newkey' do
33
33
  lambda do
34
34
  @redises.renamenx(@key, @key)
35
- end.should raise_error(RuntimeError)
35
+ end.should raise_error(Redis::CommandError)
36
36
  end
37
37
 
38
38
  it 'leaves any existing value at newkey alone' do
@@ -43,7 +43,7 @@ describe '#rpoplpush(source, destination)' do
43
43
 
44
44
  lambda do
45
45
  @redises.rpoplpush(@list1, @list2)
46
- end.should raise_error(RuntimeError)
46
+ end.should raise_error(Redis::CommandError)
47
47
  end
48
48
 
49
49
  it_should_behave_like 'a list-only command'
@@ -30,7 +30,7 @@ describe '#sdiff(key [, key, ...])' do
30
30
  it 'raises an error if given 0 arguments' do
31
31
  lambda do
32
32
  @redises.sdiff
33
- end.should raise_error(RuntimeError)
33
+ end.should raise_error(Redis::CommandError)
34
34
  end
35
35
 
36
36
  it 'raises an error if any argument is not a a set' do
@@ -38,10 +38,10 @@ describe '#sdiff(key [, key, ...])' do
38
38
 
39
39
  lambda do
40
40
  @redises.sdiff(@numbers, 'foo')
41
- end.should raise_error(RuntimeError)
41
+ end.should raise_error(Redis::CommandError)
42
42
 
43
43
  lambda do
44
44
  @redises.sdiff('foo', @numbers)
45
- end.should raise_error(RuntimeError)
45
+ end.should raise_error(Redis::CommandError)
46
46
  end
47
47
  end
@@ -41,7 +41,7 @@ describe '#sdiffstore(destination, key [, key, ...])' do
41
41
  it 'raises an error if given 0 sets' do
42
42
  lambda do
43
43
  @redises.sdiffstore(@destination)
44
- end.should raise_error(RuntimeError)
44
+ end.should raise_error(Redis::CommandError)
45
45
  end
46
46
 
47
47
  it 'raises an error if any argument is not a a set' do
@@ -49,10 +49,10 @@ describe '#sdiffstore(destination, key [, key, ...])' do
49
49
 
50
50
  lambda do
51
51
  @redises.sdiffstore(@destination, @numbers, 'mock-redis-test:notset')
52
- end.should raise_error(RuntimeError)
52
+ end.should raise_error(Redis::CommandError)
53
53
 
54
54
  lambda do
55
55
  @redises.sdiffstore(@destination, 'mock-redis-test:notset', @numbers)
56
- end.should raise_error(RuntimeError)
56
+ end.should raise_error(Redis::CommandError)
57
57
  end
58
58
  end
@@ -22,7 +22,7 @@ describe '#sinter(key [, key, ...])' do
22
22
  it 'raises an error if given 0 sets' do
23
23
  lambda do
24
24
  @redises.sinter
25
- end.should raise_error(RuntimeError)
25
+ end.should raise_error(Redis::CommandError)
26
26
  end
27
27
 
28
28
  it 'raises an error if any argument is not a a set' do
@@ -30,10 +30,10 @@ describe '#sinter(key [, key, ...])' do
30
30
 
31
31
  lambda do
32
32
  @redises.sinter(@numbers, 'mock-redis-test:notset')
33
- end.should raise_error(RuntimeError)
33
+ end.should raise_error(Redis::CommandError)
34
34
 
35
35
  lambda do
36
36
  @redises.sinter('mock-redis-test:notset', @numbers)
37
- end.should raise_error(RuntimeError)
37
+ end.should raise_error(Redis::CommandError)
38
38
  end
39
39
  end
@@ -36,7 +36,7 @@ describe '#sinterstore(destination, key [, key, ...])' do
36
36
  it 'raises an error if given 0 sets' do
37
37
  lambda do
38
38
  @redises.sinterstore(@destination)
39
- end.should raise_error(RuntimeError)
39
+ end.should raise_error(Redis::CommandError)
40
40
  end
41
41
 
42
42
  it 'raises an error if any argument is not a a set' do
@@ -44,10 +44,10 @@ describe '#sinterstore(destination, key [, key, ...])' do
44
44
 
45
45
  lambda do
46
46
  @redises.sinterstore(@destination, @numbers, 'mock-redis-test:notset')
47
- end.should raise_error(RuntimeError)
47
+ end.should raise_error(Redis::CommandError)
48
48
 
49
49
  lambda do
50
50
  @redises.sinterstore(@destination, 'mock-redis-test:notset', @numbers)
51
- end.should raise_error(RuntimeError)
51
+ end.should raise_error(Redis::CommandError)
52
52
  end
53
53
  end
@@ -25,7 +25,7 @@ describe '#sunion(key [, key, ...])' do
25
25
  it 'raises an error if given 0 sets' do
26
26
  lambda do
27
27
  @redises.sunion
28
- end.should raise_error(RuntimeError)
28
+ end.should raise_error(Redis::CommandError)
29
29
  end
30
30
 
31
31
  it 'raises an error if any argument is not a a set' do
@@ -33,10 +33,10 @@ describe '#sunion(key [, key, ...])' do
33
33
 
34
34
  lambda do
35
35
  @redises.sunion(@numbers, 'mock-redis-test:notset')
36
- end.should raise_error(RuntimeError)
36
+ end.should raise_error(Redis::CommandError)
37
37
 
38
38
  lambda do
39
39
  @redises.sunion('mock-redis-test:notset', @numbers)
40
- end.should raise_error(RuntimeError)
40
+ end.should raise_error(Redis::CommandError)
41
41
  end
42
42
  end
@@ -42,7 +42,7 @@ describe '#sunionstore(destination, key [, key, ...])' do
42
42
  it 'raises an error if given 0 sets' do
43
43
  lambda do
44
44
  @redises.sunionstore(@destination)
45
- end.should raise_error(RuntimeError)
45
+ end.should raise_error(Redis::CommandError)
46
46
  end
47
47
 
48
48
  it 'raises an error if any argument is not a a set' do
@@ -50,10 +50,10 @@ describe '#sunionstore(destination, key [, key, ...])' do
50
50
 
51
51
  lambda do
52
52
  @redises.sunionstore(@destination, @primes, 'mock-redis-test:notset')
53
- end.should raise_error(RuntimeError)
53
+ end.should raise_error(Redis::CommandError)
54
54
 
55
55
  lambda do
56
56
  @redises.sunionstore(@destination, 'mock-redis-test:notset', @primes)
57
- end.should raise_error(RuntimeError)
57
+ end.should raise_error(Redis::CommandError)
58
58
  end
59
59
  end
@@ -39,7 +39,7 @@ describe '#zinterstore(destination, keys, [:weights => [w,w,], [:aggregate => :s
39
39
  it 'raises an error if keys is empty' do
40
40
  lambda do
41
41
  @redises.zinterstore(@dest, [])
42
- end.should raise_error(RuntimeError)
42
+ end.should raise_error(Redis::CommandError)
43
43
  end
44
44
 
45
45
  context 'the :weights argument' do
@@ -52,7 +52,7 @@ describe '#zinterstore(destination, keys, [:weights => [w,w,], [:aggregate => :s
52
52
  it 'raises an error if the number of weights != the number of keys' do
53
53
  lambda do
54
54
  @redises.zinterstore(@dest, [@odds, @primes], :weights => [1, 2, 3])
55
- end.should raise_error(RuntimeError)
55
+ end.should raise_error(Redis::CommandError)
56
56
  end
57
57
  end
58
58
 
@@ -90,7 +90,7 @@ describe '#zinterstore(destination, keys, [:weights => [w,w,], [:aggregate => :s
90
90
  it 'raises an error for unknown aggregation function' do
91
91
  lambda do
92
92
  @redises.zinterstore(@dest, [@bigs, @smalls], :aggregate => :mix)
93
- end.should raise_error(RuntimeError)
93
+ end.should raise_error(Redis::CommandError)
94
94
  end
95
95
  end
96
96
  end
@@ -42,7 +42,7 @@ describe '#zrangebyscore(key, start, stop [:with_scores => true] [:limit => [off
42
42
  it "raises an error if :limit isn't a 2-tuple" do
43
43
  lambda do
44
44
  @redises.zrangebyscore(@key, -100, 100, :limit => [1, 2, 3])
45
- end.should raise_error(RuntimeError)
45
+ end.should raise_error(Redis::CommandError)
46
46
 
47
47
  lambda do
48
48
  @redises.zrangebyscore(@key, -100, 100, :limit => '1, 2')
@@ -47,7 +47,7 @@ describe '#zrevrangebyscore(key, start, stop [:with_scores => true] [:limit => [
47
47
  it "raises an error if :limit isn't a 2-tuple" do
48
48
  lambda do
49
49
  @redises.zrevrangebyscore(@key, 100, -100, :limit => [1, 2, 3])
50
- end.should raise_error(RuntimeError)
50
+ end.should raise_error(Redis::CommandError)
51
51
 
52
52
  lambda do
53
53
  @redises.zrevrangebyscore(@key, 100, -100, :limit => '1, 2')
@@ -38,7 +38,7 @@ describe '#zunionstore(destination, keys, [:weights => [w,w,], [:aggregate => :s
38
38
  it 'raises an error if keys is empty' do
39
39
  lambda do
40
40
  @redises.zunionstore(@dest, [])
41
- end.should raise_error(RuntimeError)
41
+ end.should raise_error(Redis::CommandError)
42
42
  end
43
43
 
44
44
  context 'the :weights argument' do
@@ -51,7 +51,7 @@ describe '#zunionstore(destination, keys, [:weights => [w,w,], [:aggregate => :s
51
51
  it 'raises an error if the number of weights != the number of keys' do
52
52
  lambda do
53
53
  @redises.zunionstore(@dest, [@set1, @set2, @set3], :weights => [1, 2])
54
- end.should raise_error(RuntimeError)
54
+ end.should raise_error(Redis::CommandError)
55
55
  end
56
56
  end
57
57
 
@@ -98,7 +98,7 @@ describe '#zunionstore(destination, keys, [:weights => [w,w,], [:aggregate => :s
98
98
  it 'raises an error for unknown aggregation function' do
99
99
  lambda do
100
100
  @redises.zunionstore(@dest, [@bigs, @smalls], :aggregate => :mix)
101
- end.should raise_error(RuntimeError)
101
+ end.should raise_error(Redis::CommandError)
102
102
  end
103
103
  end
104
104
  end
@@ -14,7 +14,7 @@ describe 'transactions (multi/exec/discard)' do
14
14
  @redises.multi
15
15
  lambda do
16
16
  @redises.multi
17
- end.should raise_error(RuntimeError)
17
+ end.should raise_error(Redis::CommandError)
18
18
  end
19
19
 
20
20
  it 'cleans state of tansaction wrapper if exception occurs during transaction' do
@@ -52,7 +52,7 @@ describe 'transactions (multi/exec/discard)' do
52
52
  @redises.mock.multi do |r|
53
53
  lambda do
54
54
  r.multi {}
55
- end.should raise_error(RuntimeError)
55
+ end.should raise_error(Redis::CommandError)
56
56
  end
57
57
  end
58
58
  end
@@ -66,7 +66,7 @@ describe 'transactions (multi/exec/discard)' do
66
66
  it "can't be run outside of #multi/#exec" do
67
67
  lambda do
68
68
  @redises.discard
69
- end.should raise_error(RuntimeError)
69
+ end.should raise_error(Redis::CommandError)
70
70
  end
71
71
  end
72
72
 
@@ -105,7 +105,7 @@ describe 'transactions (multi/exec/discard)' do
105
105
 
106
106
  responses = @redises.exec
107
107
  responses[0].should == 'OK'
108
- responses[1].should be_a(RuntimeError)
108
+ responses[1].should be_a(Redis::CommandError)
109
109
  responses[2].should == 1
110
110
  end
111
111
  end
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.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-04 00:00:00.000000000 Z
12
+ date: 2015-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake