redis-store 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of redis-store might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/lib/redis/store.rb +2 -1
- data/lib/redis/store/factory.rb +1 -1
- data/lib/redis/store/version.rb +1 -1
- data/test/redis/store/factory_test.rb +6 -0
- data/test/redis/store/ttl_test.rb +11 -11
- data/test/redis/store/version_test.rb +1 -1
- data/test/redis/store_test.rb +2 -6
- 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: 58dbe54f1d5825384c5def102f10898a6b9b2e49
|
4
|
+
data.tar.gz: c527c3db592454bbd8a950790debe970ee6a59ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea158585055db1bffbe1add2fca655c69eeeaebd0e0017a6fee71b029a0dfacaec915f06187d9a68bd92f218c25fffafa6cfd756bc312be5f39979e65a5f7fe
|
7
|
+
data.tar.gz: dd0f84f52e02aa72a5434b22966edc442ba84febea9478fb8c8861e8515678c718cd5c0b1c315d16d34fcbd4f6749ac3c11eadbb331ad0e5b7de03e4d8077b95
|
data/.travis.yml
CHANGED
data/lib/redis/store.rb
CHANGED
@@ -16,7 +16,8 @@ class Redis
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def to_s
|
19
|
-
|
19
|
+
h = @client.host
|
20
|
+
"Redis Client connected to #{/:/ =~ h ? '['+h+']' : h}:#{@client.port} against DB #{@client.db}"
|
20
21
|
end
|
21
22
|
|
22
23
|
private
|
data/lib/redis/store/factory.rb
CHANGED
data/lib/redis/store/version.rb
CHANGED
@@ -85,6 +85,12 @@ describe "Redis::Store::Factory" do
|
|
85
85
|
store.instance_variable_get(:@client).password.must_equal("secret")
|
86
86
|
end
|
87
87
|
|
88
|
+
it "correctly uses specified ipv6 host" do
|
89
|
+
store = Redis::Store::Factory.create "redis://[::1]:6380"
|
90
|
+
store.to_s.must_equal("Redis Client connected to [::1]:6380 against DB 0")
|
91
|
+
store.client.host.must_equal("::1")
|
92
|
+
end
|
93
|
+
|
88
94
|
it "instantiates Redis::DistributedStore" do
|
89
95
|
store = Redis::Store::Factory.create "redis://127.0.0.1:6379", "redis://127.0.0.1:6380"
|
90
96
|
store.must_be_kind_of(Redis::DistributedStore)
|
@@ -58,22 +58,22 @@ end
|
|
58
58
|
|
59
59
|
describe MockTtlStore do
|
60
60
|
let(:key) { 'hello' }
|
61
|
-
let(:
|
61
|
+
let(:mock_value) { 'value' }
|
62
62
|
let(:options) { { :expire_after => 3600 } }
|
63
63
|
let(:redis) { MockTtlStore.new }
|
64
64
|
|
65
65
|
describe '#set' do
|
66
66
|
describe 'without options' do
|
67
67
|
it 'must call super with key and value' do
|
68
|
-
redis.set(key,
|
69
|
-
redis.has_set?(key,
|
68
|
+
redis.set(key, mock_value)
|
69
|
+
redis.has_set?(key, mock_value).must_equal true
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
describe 'with options' do
|
74
74
|
it 'must call setex with proper expiry and set raw to true' do
|
75
|
-
redis.set(key,
|
76
|
-
redis.has_setex?(key, options[:expire_after],
|
75
|
+
redis.set(key, mock_value, options)
|
76
|
+
redis.has_setex?(key, options[:expire_after], mock_value, :raw => true).must_equal true
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -81,25 +81,25 @@ describe MockTtlStore do
|
|
81
81
|
describe '#setnx' do
|
82
82
|
describe 'without expiry' do
|
83
83
|
it 'must call super with key and value' do
|
84
|
-
redis.setnx(key,
|
85
|
-
redis.has_setnx?(key,
|
84
|
+
redis.setnx(key, mock_value)
|
85
|
+
redis.has_setnx?(key, mock_value)
|
86
86
|
end
|
87
87
|
|
88
88
|
it 'must not call expire' do
|
89
89
|
MockTtlStore.any_instance.expects(:expire).never
|
90
90
|
|
91
|
-
redis.setnx(key,
|
91
|
+
redis.setnx(key, mock_value)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
describe 'with expiry' do
|
96
96
|
it 'must call setnx with key and value and set raw to true' do
|
97
|
-
redis.setnx(key,
|
98
|
-
redis.has_setnx?(key,
|
97
|
+
redis.setnx(key, mock_value, options)
|
98
|
+
redis.has_setnx?(key, mock_value, :raw => true).must_equal true
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'must call expire' do
|
102
|
-
redis.setnx(key,
|
102
|
+
redis.setnx(key, mock_value, options)
|
103
103
|
redis.has_expire?(key, options[:expire_after]).must_equal true
|
104
104
|
end
|
105
105
|
end
|
data/test/redis/store_test.rb
CHANGED
@@ -22,28 +22,24 @@ describe Redis::Store do
|
|
22
22
|
|
23
23
|
describe '#set' do
|
24
24
|
describe 'with expiry' do
|
25
|
-
let(:key) { 'key' }
|
26
|
-
let(:value) { 'value' }
|
27
25
|
let(:options) { { :expire_after => 3600 } }
|
28
26
|
|
29
27
|
it 'must not double marshall' do
|
30
28
|
Marshal.expects(:dump).once
|
31
29
|
|
32
|
-
@store.set(key, value, options)
|
30
|
+
@store.set('key', 'value', options)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
36
34
|
|
37
35
|
describe '#setnx' do
|
38
36
|
describe 'with expiry' do
|
39
|
-
let(:key) { 'key' }
|
40
|
-
let(:value) { 'value' }
|
41
37
|
let(:options) { { :expire_after => 3600 } }
|
42
38
|
|
43
39
|
it 'must not double marshall' do
|
44
40
|
Marshal.expects(:dump).once
|
45
41
|
|
46
|
-
@store.setnx(key, value, options)
|
42
|
+
@store.setnx('key', 'value', options)
|
47
43
|
end
|
48
44
|
end
|
49
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project: redis-store
|
165
|
-
rubygems_version: 2.4.
|
165
|
+
rubygems_version: 2.4.8
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Redis stores for Ruby frameworks
|