mock_redis 0.15.1 → 0.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.overcommit.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -2
- data/Rakefile +0 -8
- data/lib/mock_redis.rb +1 -1
- data/lib/mock_redis/string_methods.rb +1 -1
- data/lib/mock_redis/version.rb +1 -1
- data/lib/mock_redis/zset.rb +4 -4
- data/spec/commands/expireat_spec.rb +1 -1
- data/spec/commands/getbit_spec.rb +1 -1
- data/spec/commands/hgetall_spec.rb +1 -1
- data/spec/commands/pexpireat_spec.rb +1 -1
- data/spec/commands/setbit_spec.rb +2 -2
- data/spec/commands/zrangebyscore_spec.rb +4 -0
- data/spec/spec_helper.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb02c2a8cc52839aa47201cdc27ec063f1fce875
|
4
|
+
data.tar.gz: 991d301fa70caa3709990f0d95e350dfe54dddc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04b4a3f08d21973e3e0943cd4494f77b1bfd6a4c9b2fb8320034feb903995674c8acce226dd86a5f01caf2eb8af5499a6ea6c6fe7d705d9465d29026d09de7be
|
7
|
+
data.tar.gz: 7651910b6293fb19d983aeac9c896b310848f51cbc5527eaeb32e7c550734b04b79125cfbb75388f587b64277087876d84006bfac40000d02a071f0a07c7d972
|
data/.overcommit.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -4,10 +4,10 @@ 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.
|
7
|
+
gem 'overcommit', '0.28.0'
|
8
8
|
|
9
9
|
# Pin tool versions (which are executed by Overcommit) for Travis builds
|
10
|
-
gem 'rubocop', '0.
|
10
|
+
gem 'rubocop', '0.33.0'
|
11
11
|
gem 'travis', '~> 1.7'
|
12
12
|
|
13
13
|
gem 'coveralls', require: false
|
data/Rakefile
CHANGED
data/lib/mock_redis.rb
CHANGED
@@ -195,7 +195,7 @@ class MockRedis
|
|
195
195
|
end
|
196
196
|
|
197
197
|
char = str[char_index]
|
198
|
-
char = char.chr if char.respond_to?(:chr)
|
198
|
+
char = char.chr if char.respond_to?(:chr) # ruby 1.8 vs 1.9
|
199
199
|
char_as_number = char.each_byte.reduce(0) do |a, byte|
|
200
200
|
(a << 8) + byte
|
201
201
|
end
|
data/lib/mock_redis/version.rb
CHANGED
data/lib/mock_redis/zset.rb
CHANGED
@@ -47,8 +47,8 @@ class MockRedis
|
|
47
47
|
when '+inf'
|
48
48
|
lambda { |_| false }
|
49
49
|
when /\((.*)$/
|
50
|
-
|
51
|
-
lambda { |x| x.to_f >
|
50
|
+
left_val = $1.to_f
|
51
|
+
lambda { |x| x.to_f > left_val }
|
52
52
|
else
|
53
53
|
lambda { |x| x.to_f >= min.to_f }
|
54
54
|
end
|
@@ -59,8 +59,8 @@ class MockRedis
|
|
59
59
|
when '+inf'
|
60
60
|
lambda { |_| true }
|
61
61
|
when /\((.*)$/
|
62
|
-
|
63
|
-
lambda { |x| x.to_f <
|
62
|
+
right_val = $1.to_f
|
63
|
+
lambda { |x| x.to_f < right_val }
|
64
64
|
else
|
65
65
|
lambda { |x| x.to_f <= max.to_f }
|
66
66
|
end
|
@@ -21,7 +21,7 @@ describe '#expireat(key, timestamp)' do
|
|
21
21
|
|
22
22
|
it "raises an error if you don't give it a Unix timestamp" do
|
23
23
|
lambda do
|
24
|
-
@redises.expireat(@key, Time.now)
|
24
|
+
@redises.expireat(@key, Time.now) # oops, forgot .to_i
|
25
25
|
end.should raise_error(Redis::CommandError)
|
26
26
|
end
|
27
27
|
|
@@ -22,7 +22,7 @@ describe '#hgetall(key)' do
|
|
22
22
|
mr = MockRedis.new
|
23
23
|
mr.hset(@key, 'k1', 'v1')
|
24
24
|
mr.hset(@key, 'k2', 'v2')
|
25
|
-
hash =
|
25
|
+
hash = mr.hgetall(@key)
|
26
26
|
hash['dont'] = 'mutate'
|
27
27
|
new_hash = mr.hgetall(@key)
|
28
28
|
new_hash.keys.sort.should == %w[k1 k2]
|
@@ -22,7 +22,7 @@ describe '#pexpireat(key, timestamp_ms)' do
|
|
22
22
|
|
23
23
|
it "raises an error if you don't give it a Unix timestamp" do
|
24
24
|
lambda do
|
25
|
-
@redises.pexpireat(@key, Time.now)
|
25
|
+
@redises.pexpireat(@key, Time.now) # oops, forgot .to_i
|
26
26
|
end.should raise_error(Redis::CommandError)
|
27
27
|
end
|
28
28
|
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
describe '#setbit(key, offset)' do
|
5
5
|
before do
|
6
6
|
@key = 'mock-redis-test:setbit'
|
7
|
-
@redises.set(@key, 'h')
|
7
|
+
@redises.set(@key, 'h') # ASCII 0x68
|
8
8
|
end
|
9
9
|
|
10
10
|
it "returns the original stored bit's value" do
|
@@ -23,7 +23,7 @@ describe '#setbit(key, offset)' do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'does the right thing with multibyte characters' do
|
26
|
-
@redises.set(@key, '€99.94')
|
26
|
+
@redises.set(@key, '€99.94') # the euro sign is 3 bytes wide in UTF-8
|
27
27
|
@redises.setbit(@key, 63, 1).should == 0
|
28
28
|
@redises.get(@key).should == '€99.95'
|
29
29
|
end
|
@@ -75,5 +75,9 @@ describe '#zrangebyscore(key, start, stop [:with_scores => true] [:limit => [off
|
|
75
75
|
@redises.zrangebyscore(@key, '3', '(4').should == ['Jefferson']
|
76
76
|
end
|
77
77
|
|
78
|
+
it 'honors exclusive ranges on the left and the right simultaneously' do
|
79
|
+
@redises.zrangebyscore(@key, '(1', '(4').should == %w[Adams Jefferson]
|
80
|
+
end
|
81
|
+
|
78
82
|
it_should_behave_like 'a zset-only command'
|
79
83
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,8 +27,8 @@ module TypeCheckingHelper
|
|
27
27
|
|
28
28
|
def args_for_method(method)
|
29
29
|
method_arity = @redises.real.method(method).arity
|
30
|
-
if method_arity < 0
|
31
|
-
[1, 2]
|
30
|
+
if method_arity < 0 # -1 comes from def foo(*args)
|
31
|
+
[1, 2] # probably good enough
|
32
32
|
else
|
33
33
|
1.upto(method_arity - 1).to_a
|
34
34
|
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.
|
4
|
+
version: 0.15.2
|
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-
|
12
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|