mock_redis 0.17.1 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/mock_redis/version.rb +1 -1
- data/lib/mock_redis/zset_methods.rb +3 -1
- data/spec/commands/zrange_spec.rb +20 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 293ef8fd1bbce6f4a890edc7dbf7afa1235eb885
|
4
|
+
data.tar.gz: 2339b903a136416a24d6630c06dde8ffcde8eee1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec8caa7328b7365c9b120837acd873bf535ccee1364590045d8be55989e20e4a53d00fd5952cda910826ba506d61b2a509b06e139deff5f8bd79029475c9b28c
|
7
|
+
data.tar.gz: 68fcb5906a717d679f2d8f3278226a0a213dc4250e314e97fdba647aaf2b3bcd9dec0640ca8db4b916dea9278d4737fce17d3b6f6de8d6288947a83c93128881
|
data/CHANGELOG.md
CHANGED
data/lib/mock_redis/version.rb
CHANGED
@@ -118,7 +118,9 @@ class MockRedis
|
|
118
118
|
|
119
119
|
def zrange(key, start, stop, options = {})
|
120
120
|
with_zset_at(key) do |z|
|
121
|
-
|
121
|
+
start = [start.to_i, -z.sorted.size].max
|
122
|
+
stop = stop.to_i
|
123
|
+
to_response(z.sorted[start..stop] || [], options)
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
@@ -46,6 +46,26 @@ describe '#zrange(key, start, stop [, :with_scores => true])' do
|
|
46
46
|
@redises.zrange(@key, 5, -1).should == []
|
47
47
|
end
|
48
48
|
|
49
|
+
it 'returns entire list when start is out of bounds with negative end in bounds' do
|
50
|
+
@redises.zrange(@key, -5, -1).should == %w[Washington Adams Jefferson Madison]
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns correct subset when start is out of bounds with positive end in bounds' do
|
54
|
+
@redises.zrange(@key, -5, 1).should == %w[Washington Adams]
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'returns empty list when start is in bounds with negative end out of bounds' do
|
58
|
+
@redises.zrange(@key, 1, -5).should == []
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'returns empty list when start is 0 with negative end out of bounds' do
|
62
|
+
@redises.zrange(@key, 0, -5).should == []
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'returns correct subset when start is in bounds with negative end in bounds' do
|
66
|
+
@redises.zrange(@key, 1, -1).should == %w[Adams Jefferson Madison]
|
67
|
+
end
|
68
|
+
|
49
69
|
it 'returns the scores when :with_scores is specified' do
|
50
70
|
@redises.zrange(@key, 0, 1, :with_scores => true).
|
51
71
|
should == [['Washington', 1.0], ['Adams', 2.0]]
|
data/spec/spec_helper.rb
CHANGED
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.17.
|
4
|
+
version: 0.17.3
|
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:
|
12
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
281
|
version: '0'
|
282
282
|
requirements: []
|
283
283
|
rubyforge_project:
|
284
|
-
rubygems_version: 2.5.
|
284
|
+
rubygems_version: 2.5.2
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
287
|
summary: Redis mock that just lives in memory; useful for testing.
|