redis-activesupport 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbde1fe9e22083ceba3ff74535d88465a7097434
4
- data.tar.gz: e807712d514c1f5361ef005cd04a028fa802d19f
3
+ metadata.gz: 64b2b49c1f7d423deec69ac3a844110f7324e6e5
4
+ data.tar.gz: d76eeb83e1ffbacc5d2527ae41a9ff3d56b0bac3
5
5
  SHA512:
6
- metadata.gz: de702e1868ba3090390e4c52cc82e9d7ad89e9252cdf45aebf85dd5c5d46a20c917ce8385cd7bcd424e6e4efa1fdeb7b7b106145597bd57dc9a944808264a457
7
- data.tar.gz: f0cbe5961a33c63a1b4985ea0415f4391de07dc4e7137fbe898100a2eec96d38d1846c89a80ad31587c3814b705c664f0e5f64d303638dfdf0b0c632cbe80711
6
+ metadata.gz: a3d10878da4ffb180e48d1b520aac5c03189be75c803e40907d8ae616a917430263f40e2cde3e449f38aedfdfab1603e25a1e9626f78eaa2d2601820373a20e3
7
+ data.tar.gz: 0399f77052e5660accfa3349a68571f11bcab77d1fc92e9652f3669df08cdf2caebf6f08a38107c3dc6ae7861183edb086a0fc54ebfb78c1f04044721910efbd
@@ -34,7 +34,7 @@ module ActiveSupport
34
34
  # pool: ::ConnectionPool.new(size: 1, timeout: 1) { ::Redis::Store::Factory.create("localhost:6379/0") })
35
35
  # # => supply an existing connection pool (e.g. for use with redis-sentinel or redis-failover)
36
36
  def initialize(*addresses)
37
- @options = addresses.extract_options!
37
+ @options = addresses.dup.extract_options!
38
38
 
39
39
  @data = if @options[:pool]
40
40
  raise "pool must be an instance of ConnectionPool" unless @options[:pool].is_a?(ConnectionPool)
@@ -45,9 +45,9 @@ module ActiveSupport
45
45
  pool_options[:size] = options[:pool_size] if options[:pool_size]
46
46
  pool_options[:timeout] = options[:pool_timeout] if options[:pool_timeout]
47
47
  @pooled = true
48
- ::ConnectionPool.new(pool_options) { ::Redis::Store::Factory.create(addresses) }
48
+ ::ConnectionPool.new(pool_options) { ::Redis::Store::Factory.create(*addresses) }
49
49
  else
50
- ::Redis::Store::Factory.create(addresses)
50
+ ::Redis::Store::Factory.create(*addresses)
51
51
  end
52
52
 
53
53
  super(@options)
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  module ActiveSupport
3
- VERSION = '4.1.0'
3
+ VERSION = '4.1.1'
4
4
  end
5
5
  end
@@ -25,6 +25,36 @@ describe ActiveSupport::Cache::RedisStore do
25
25
  end
26
26
  end
27
27
 
28
+ it "connects using an hash of options" do
29
+ address = { host: '127.0.0.1', port: '6380', db: '1' }
30
+ store = ActiveSupport::Cache::RedisStore.new(address.merge(pool_size: 5, pool_timeout: 10))
31
+ redis = Redis.new(url: "redis://127.0.0.1:6380/1")
32
+ redis.flushall
33
+
34
+ store.data.class.must_equal(::ConnectionPool)
35
+ store.data.instance_variable_get(:@size).must_equal(5)
36
+ store.data.instance_variable_get(:@timeout).must_equal(10)
37
+
38
+ store.write("rabbit", 0)
39
+
40
+ redis.exists("rabbit").must_equal(true)
41
+ end
42
+
43
+ it "connects using an string of options" do
44
+ address = "redis://127.0.0.1:6380/1"
45
+ store = ActiveSupport::Cache::RedisStore.new(address, pool_size: 5, pool_timeout: 10)
46
+ redis = Redis.new(url: address)
47
+ redis.flushall
48
+
49
+ store.data.class.must_equal(::ConnectionPool)
50
+ store.data.instance_variable_get(:@size).must_equal(5)
51
+ store.data.instance_variable_get(:@timeout).must_equal(10)
52
+
53
+ store.write("rabbit", 0)
54
+
55
+ redis.exists("rabbit").must_equal(true)
56
+ end
57
+
28
58
  it "raises an error if :pool isn't a pool" do
29
59
  assert_raises(RuntimeError, 'pool must be an instance of ConnectionPool') do
30
60
  ActiveSupport::Cache::RedisStore.new(pool: 'poolio')
@@ -63,7 +93,7 @@ describe ActiveSupport::Cache::RedisStore do
63
93
  end
64
94
 
65
95
  it "creates a distributed store when given multiple addresses" do
66
- underlying_store = instantiate_store("redis://127.0.0.1:6380/1",
96
+ underlying_store = instantiate_store("redis://127.0.0.1:6380/1",
67
97
  "redis://127.0.0.1:6381/1")
68
98
  underlying_store.must_be_instance_of(::Redis::DistributedStore)
69
99
  end
@@ -2,6 +2,6 @@ require 'test_helper'
2
2
 
3
3
  describe Redis::ActiveSupport::VERSION do
4
4
  it 'returns current version' do
5
- Redis::ActiveSupport::VERSION.must_equal '4.0.0'
5
+ Redis::ActiveSupport::VERSION.must_equal '4.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.1.1
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-07-12 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-store