multi_cache-rails 3.2.1 → 3.2.2

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: 59eca02809a426975afff0519d87d6c1c1ac28bb
4
- data.tar.gz: 4385cf909f18177a290e84516d2d267a9a3728ee
3
+ metadata.gz: 0c39eda7580775e4c1b15bdbf8d19f9b441ce820
4
+ data.tar.gz: d38e758e5e143cedead4500f52d590d922926d73
5
5
  SHA512:
6
- metadata.gz: 87d3d85aa07dfc7d9f3aa95dc55aa5362c4c88fbad7526c9fc36087e00975a6033ac3aab87db9f180724407508af04dbde03eaae6b77885448e09f40532b47e4
7
- data.tar.gz: 7ef0cbce67561e229d50f069fdb6e8056732f5ff263e915160ce904b99c48a2c1c6e611c515efca54ccd970e20d936bbc2fc1c6d04613123ab69119db05cc1ca
6
+ metadata.gz: d8c595a9fa3090a9b146ab39922df40f43ec97ee37b5c97c3294e776049fb6a1138e519bc0851b98bdf9fd48b49194c155917131f417c72400367260df5d764d
7
+ data.tar.gz: 370fbc8e4796aac3eab40dae452c2f7e2145aa7d4f08721c05c65dca445b4698107c6990da4a401b1482cfdfad6a55ff663f07cd6810069ab2561841ab944746
@@ -14,7 +14,7 @@ module Rails
14
14
  end
15
15
 
16
16
  def cache(name = :default)
17
- return nil unless defined? @cache
17
+ @cache = { default: RAILS_CACHE } unless defined? @cache
18
18
  return RAILS_CACHE if name == :default
19
19
  @cache[name] || RAILS_CACHE
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module MultiCache
2
2
  module Rails
3
- VERSION = '3.2.1'
3
+ VERSION = '3.2.2'
4
4
  end
5
5
  end
data/spec/rails_spec.rb CHANGED
@@ -5,12 +5,23 @@ module Rails
5
5
  let!(:set2) { Rails.cache = { name: :secondary, cache: 'cache_object2' } }
6
6
  let!(:set3) { Rails.cache = { name: :tertiary, cache: 'cache_object3' } }
7
7
 
8
- it 'retyrns cache object' do
8
+ it 'returns cache object' do
9
9
  expect(Rails.cache).to eq 'cache_object1'
10
10
  expect(Rails.cache(:default)).to eq 'cache_object1'
11
11
  expect(Rails.cache(:secondary)).to eq 'cache_object2'
12
12
  expect(Rails.cache(:tertiary)).to eq 'cache_object3'
13
13
  expect(Rails.cache(:nothing)).to eq 'cache_object1'
14
14
  end
15
+
16
+ context 'only set RAILS_CACHE' do
17
+ before do
18
+ silence_warnings { Object.const_set 'RAILS_CACHE', 'cache_object1' }
19
+ end
20
+
21
+ it 'returns cache object' do
22
+ expect(Rails.cache).to eq 'cache_object1'
23
+ expect(Rails.cache(:nothing)).to eq 'cache_object1'
24
+ end
25
+ end
15
26
  end
16
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi_cache-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Uesugi