lhc 5.0.1 → 5.0.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: e0fde445aaa4f9daa0722ed7b86865670c70128f
4
- data.tar.gz: b1115f8d198edb3e65d66d00b222df920954f2c1
3
+ metadata.gz: ca22edb3d907f1f5eea91ae7d046f6853d8d44e6
4
+ data.tar.gz: 8384401b348e2be3abe4be92a613087002af0153
5
5
  SHA512:
6
- metadata.gz: 9e5f861c879044c954eb4f9c32142dfd9753824e4c007cb8b29a5a24e63ee1eacc7fbacc25d6cfd5de63ae5f1b5a30d0725be2117d81025e638e1bfb55d54533
7
- data.tar.gz: 1dddaf5ef3f644a9f78ba7382a2de0db6052cf36c85a06a679a07a435d34e7537d0cfa414ed57b68ce15ae7c245b5c00d83448345cb3f1c9b3503e6e36c8cc22
6
+ metadata.gz: 3172e1a788c94cd7f1b04a0f22812abdf5e9373a0094bdec244d72af460c888aa073ce64958363a1ebc4506a88068d811ad4a65859519b64ff010158ce0ad16a
7
+ data.tar.gz: a5413bab8b96564f62a2c1c2c9af3ce861cdb5a419bef0f286223e286d86a7859ba5c0993cad1b91131f6e1da33fd542ecca5990012b0cf06a43778544924e77
data/.gitignore CHANGED
@@ -33,3 +33,5 @@ Gemfile.lock
33
33
  /vendor/assets/bower_components
34
34
  *.bowerrc
35
35
  bower.json
36
+
37
+ spec/dummy/tmp/cache
@@ -30,7 +30,7 @@ module LHC
30
30
  options.each do |option|
31
31
  request = LHC::Request.new(option, false)
32
32
  requests << request
33
- hydra.queue request.raw
33
+ hydra.queue request.raw unless request.response.present?
34
34
  end
35
35
  hydra.run
36
36
  requests.map(&:response)
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION ||= "5.0.1"
2
+ VERSION ||= "5.0.2"
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'rails_helper'
2
+
3
+ describe LHC::Caching do
4
+ before(:each) do
5
+ LHC.config.interceptors = [LHC::Caching]
6
+ LHC::Caching.cache = Rails.cache
7
+ Rails.cache.clear
8
+ end
9
+
10
+ let!(:first_request) do
11
+ stub_request(:get, "http://local.ch/").to_return(body: 'Website')
12
+ end
13
+
14
+ let!(:second_request) do
15
+ stub_request(:get, "http://local.ch/weather").to_return(body: 'The weather')
16
+ end
17
+
18
+ it 'does not fetch requests served from cache when doing requests in parallel with hydra' do
19
+ LHC.request([{ url: 'http://local.ch', cache: true }, { url: 'http://local.ch/weather', cache: true }])
20
+ LHC.request([{ url: 'http://local.ch', cache: true }, { url: 'http://local.ch/weather', cache: true }])
21
+ assert_requested first_request, times: 1
22
+ assert_requested second_request, times: 1
23
+ end
24
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhc
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhc/contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -259,6 +259,7 @@ files:
259
259
  - spec/interceptors/auth/bearer_spec.rb
260
260
  - spec/interceptors/before_request_spec.rb
261
261
  - spec/interceptors/before_response_spec.rb
262
+ - spec/interceptors/caching/hydra_spec.rb
262
263
  - spec/interceptors/caching/main_spec.rb
263
264
  - spec/interceptors/caching/methods_spec.rb
264
265
  - spec/interceptors/caching/parameters_spec.rb
@@ -384,6 +385,7 @@ test_files:
384
385
  - spec/interceptors/auth/bearer_spec.rb
385
386
  - spec/interceptors/before_request_spec.rb
386
387
  - spec/interceptors/before_response_spec.rb
388
+ - spec/interceptors/caching/hydra_spec.rb
387
389
  - spec/interceptors/caching/main_spec.rb
388
390
  - spec/interceptors/caching/methods_spec.rb
389
391
  - spec/interceptors/caching/parameters_spec.rb