flexirest 1.3.28 → 1.3.29

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: 06f57e7a69b3da8a839a5ee30a1c33cd25576fd0
4
- data.tar.gz: 36070e158d45d127b26dc497f57d0f47a36b7eb2
3
+ metadata.gz: 09154cafbcffc062d4414e0cb632075b5404fde8
4
+ data.tar.gz: e5480c5145b3218380e06fd01c67d02956defd2b
5
5
  SHA512:
6
- metadata.gz: 5cbcb419898a3c14349f6eb57becd64cb3d04b2c89e59dc9f21a5163d9df3aadcb3f2358aef4e0999094b73c7f5d3f070d15f4f266d05d3d6343787d2f1f2a45
7
- data.tar.gz: 29f9987cb73598b12f6aae2f9eadca45b2b294f19325033b93a6027a51c1f0a280fdc5054094f3c8842434e1cc2570379c32c7047399b3eefb4174e1823ab32b
6
+ metadata.gz: 890f5a711e634ec310a781ccd1e404e53ad7ffa1fc341b077de6277746f5f351c3d833f28883e5c3fef043f2b4351c1d5471f98d7e4610e8aba8ff357c306d65
7
+ data.tar.gz: 845cad98cb6c3178b14ef44438247c3bf242a70df68ecba002eef1579959b041743171226e6c86fd80633aa2c27bed7a5ec4acfcdf127d83e17076dd64d7ac97
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.29
4
+
5
+ Bugfix:
6
+
7
+ - Setting `perform_caching` on `Flexirest::Base` was being ignored
8
+
3
9
  ## 1.3.28
4
10
 
5
11
  Feature:
@@ -5,13 +5,16 @@ module Flexirest
5
5
 
6
6
  def perform_caching(value = nil)
7
7
  @perform_caching ||= nil
8
- @@perform_caching ||= nil
9
8
  if value.nil?
10
- if @perform_caching.nil?
9
+ value = if @perform_caching.nil?
11
10
  @@perform_caching
12
11
  else
13
12
  @perform_caching
14
13
  end
14
+ if value.nil? && superclass.respond_to?(:perform_caching)
15
+ value = superclass.perform_caching
16
+ end
17
+ value
15
18
  else
16
19
  @perform_caching = value
17
20
  end
@@ -40,8 +43,8 @@ module Flexirest
40
43
  end
41
44
 
42
45
  def _reset_caching!
43
- @@perform_caching = false
44
- @perform_caching = false
46
+ @@perform_caching = nil
47
+ @perform_caching = nil
45
48
  @@cache_store = nil
46
49
  end
47
50
 
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.3.28"
2
+ VERSION = "1.3.29"
3
3
  end
@@ -189,7 +189,7 @@ describe Flexirest::Caching do
189
189
  expect(ret._status).to eq(200)
190
190
  end
191
191
 
192
- it "should not write the response to the cache unless if has caching headers" do
192
+ it "should not write the response to the cache unless it has caching headers" do
193
193
  expect_any_instance_of(CachingExampleCacheStore5).to receive(:read).once.with("Person:/").and_return(nil)
194
194
  expect_any_instance_of(CachingExampleCacheStore5).not_to receive(:write)
195
195
  expect_any_instance_of(Flexirest::Connection).to receive(:get).with("/", an_instance_of(Hash)).and_return(OpenStruct.new(status:200, body:"{\"result\":true}", headers:{}))
@@ -204,6 +204,29 @@ describe Flexirest::Caching do
204
204
  Person.all
205
205
  end
206
206
 
207
+ it "should not write the response to the cache if there's an etag but perform_caching is off" do
208
+ expect(Person.cache_store).to_not receive(:read)
209
+ expect(Person.cache_store).to_not receive(:write)
210
+ expect_any_instance_of(Flexirest::Connection).to receive(:get).with("/", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, body:"{\"result\":true}", response_headers:{etag:"1234567890"})))
211
+ Person.perform_caching false
212
+ Person.all
213
+ end
214
+
215
+ it "should not write the response to the cache if there's an etag but perform_caching is off at the base level" do
216
+ begin
217
+ caching = Flexirest::Base.perform_caching
218
+ Flexirest::Base.perform_caching false
219
+ Person._reset_caching!
220
+ Person.cache_store = CachingExampleCacheStore5.new
221
+ expect(Person.cache_store).to_not receive(:read)
222
+ expect(Person.cache_store).to_not receive(:write)
223
+ expect_any_instance_of(Flexirest::Connection).to receive(:get).with("/", an_instance_of(Hash)).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, body:"{\"result\":true}", response_headers:{etag:"1234567890"})))
224
+ Person.all
225
+ ensure
226
+ Flexirest::Base.perform_caching caching
227
+ end
228
+ end
229
+
207
230
  it "should write the response to the cache if there's a hard expiry" do
208
231
  expect_any_instance_of(CachingExampleCacheStore5).to receive(:read).once.with("Person:/").and_return(nil)
209
232
  expect_any_instance_of(CachingExampleCacheStore5).to receive(:write).once.with("Person:/", an_instance_of(String), an_instance_of(Hash))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.28
4
+ version: 1.3.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler