cassette 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7cb4c150e5462c22f1c9b50efc460f97b467fb46
4
- data.tar.gz: 62125a47efc5907be567ddb8f5110e115f5b3822
2
+ SHA256:
3
+ metadata.gz: 6541e55b06cc97ea1e68cd330af18791328e1cc72a9b04f9e93aa6e2f1032bc3
4
+ data.tar.gz: 765652bf692b0dd1c8b3ef1b6bd7eaac59a2da11d0fd5569e8c565b8963aed9a
5
5
  SHA512:
6
- metadata.gz: f5180968617bf8f175eedc6df3ebad946a29d53f8fc0f4bafad42485d4bb6df55f78d2ee7531c9e1518ceaa2acedec9cc1755b2587cc83dbb018c42efc472455
7
- data.tar.gz: 48730cd09644516e5ea5f17e17f22cc8814213f7664021ef9b482961974bad2102022e8b81cab0b430fb9c5276d8f84bbeb047647cec55526cf331df374ff3fb
6
+ metadata.gz: a0d7e79d8ab928c6e3179bda6271eab2f6744662a37057b2dba53f92c1f5cc8b9486b6e86382f71cd2fddba069121ca49d392e28a7731db8b2c650e4dd77ebb0
7
+ data.tar.gz: 2721a7af21ff3a47ca13f495ae73c9c9e623bce36fb7d6d3418c5d69dac286760573aa2b653a791f25ab545abdaeea04e8a5824bdea9004f81f7bbca98eb4fe7
@@ -8,7 +8,7 @@ end
8
8
 
9
9
  module Cassette
10
10
  module Cache
11
- def backend
11
+ def self.backend
12
12
  @backend ||= begin
13
13
  if defined?(::Rails) && ::Rails.cache
14
14
  ::Rails.cache
@@ -20,6 +20,14 @@ module Cassette
20
20
  end
21
21
  end
22
22
 
23
+ def self.backend=(backend)
24
+ @backend = backend
25
+ end
26
+
27
+ def backend
28
+ @backend ||= Cassette::Cache.backend
29
+ end
30
+
23
31
  attr_writer :backend
24
32
 
25
33
  def uses_key(key)
@@ -2,7 +2,7 @@ module Cassette
2
2
  class Version
3
3
  MAJOR = '1'
4
4
  MINOR = '2'
5
- PATCH = '3'
5
+ PATCH = '4'
6
6
 
7
7
  def self.version
8
8
  [MAJOR, MINOR, PATCH].join('.')
@@ -2,27 +2,65 @@
2
2
 
3
3
  describe Cassette::Cache do
4
4
  subject do
5
- c = Class.new
6
- c.send(:include, Cassette::Cache)
7
- c.new
5
+ cached()
6
+ end
7
+
8
+ after do
9
+ described_class.instance_variable_set(:@backend, nil)
10
+ end
11
+
12
+ describe '.backend' do
13
+ it 'defaults to rails backend' do
14
+ rails = double('Rails')
15
+ cache = double('cache_backend')
16
+ allow(rails).to receive(:cache).and_return(cache)
17
+ stub_const('Rails', rails)
18
+
19
+ expect(described_class.backend).to eql(cache)
20
+ end
21
+ end
22
+
23
+ describe '.backend=' do
24
+ it 'provides a default backend for new instances' do
25
+ backend = double('backend')
26
+ expect(subject.backend).not_to eq(backend)
27
+
28
+ described_class.backend = backend
29
+
30
+ new_instance = cached()
31
+ expect(new_instance.backend).to eq(backend)
32
+ expect(new_instance.backend).not_to eq(subject.backend)
33
+ end
34
+
35
+ it 'sets the default backend' do
36
+ backend = double('backend')
37
+ expect(described_class.backend).not_to eq(backend)
38
+
39
+ described_class.backend = backend
40
+
41
+ expect(described_class.backend).to eq(backend)
42
+ end
8
43
  end
9
44
 
10
- describe 'backend' do
45
+ describe '#backend' do
11
46
  before { subject.backend = nil }
12
47
  after { subject.backend = nil }
13
48
 
14
49
  it 'sets the backend' do
15
50
  backend = double('Backend')
51
+
16
52
  subject.backend = backend
53
+
17
54
  expect(subject.backend).to eql(backend)
18
55
  end
19
56
 
20
57
  it 'defaults to rails backend' do
21
58
  rails = double('Rails')
22
- allow(rails).to receive(:cache).and_return(rails)
59
+ cache = double('cache_backend')
60
+ allow(rails).to receive(:cache).and_return(cache)
23
61
  stub_const('Rails', rails)
24
62
 
25
- expect(subject.backend).to eql(rails)
63
+ expect(subject.backend).to eql(cache)
26
64
  end
27
65
  end
28
66
 
@@ -34,4 +72,10 @@ describe Cassette::Cache do
34
72
  subject.fetch('Generator', max_uses: 5) { generator.generate }
35
73
  end
36
74
  end
75
+
76
+ def cached
77
+ c = Class.new
78
+ c.send(:include, Cassette::Cache)
79
+ c.new
80
+ end
37
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassette
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Hermida Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2019-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -290,8 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
290
  - !ruby/object:Gem::Version
291
291
  version: '0'
292
292
  requirements: []
293
- rubyforge_project:
294
- rubygems_version: 2.5.1
293
+ rubygems_version: 3.0.3
295
294
  signing_key:
296
295
  specification_version: 4
297
296
  summary: Generates, validates and caches TGTs and STs