lhc 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.localch.yml +190 -0
  3. data/.rubocop.yml +10 -0
  4. data/cider-ci.yml +2 -1
  5. data/cider-ci/jobs/rspec.yml +48 -0
  6. data/cider-ci/jobs/rubocop.yml +55 -0
  7. data/cider-ci/scripts/bundle.yml +2 -0
  8. data/cider-ci/scripts/github_comment.yml +6 -0
  9. data/cider-ci/scripts/rspec.yml +4 -0
  10. data/cider-ci/scripts/rubocop.yml +5 -0
  11. data/cider-ci/scripts/ruby-version.yml +2 -0
  12. data/cider-ci/scripts/tmp-cache.yml +2 -0
  13. data/lhc.gemspec +2 -1
  14. data/lib/lhc.rb +1 -1
  15. data/lib/lhc/concerns/lhc/basic_methods.rb +4 -6
  16. data/lib/lhc/concerns/lhc/formats.rb +0 -2
  17. data/lib/lhc/endpoint.rb +8 -6
  18. data/lib/lhc/error.rb +3 -1
  19. data/lib/lhc/errors/parser_error.rb +4 -0
  20. data/lib/lhc/formats/json.rb +18 -4
  21. data/lib/lhc/interceptor.rb +2 -0
  22. data/lib/lhc/interceptor_processor.rb +1 -1
  23. data/lib/lhc/request.rb +12 -10
  24. data/lib/lhc/response.rb +3 -9
  25. data/lib/lhc/version.rb +1 -1
  26. data/non_rails_spec/request/request_spec.rb +2 -2
  27. data/spec/basic_methods/delete_spec.rb +4 -6
  28. data/spec/basic_methods/get_spec.rb +3 -6
  29. data/spec/basic_methods/post_spec.rb +7 -9
  30. data/spec/basic_methods/put_spec.rb +7 -9
  31. data/spec/basic_methods/request_spec.rb +2 -4
  32. data/spec/config/endpoints_spec.rb +13 -16
  33. data/spec/config/placeholders_spec.rb +9 -11
  34. data/spec/dummy/bin/rails +1 -1
  35. data/spec/dummy/config.ru +1 -1
  36. data/spec/dummy/config/initializers/cookies_serializer.rb +1 -1
  37. data/spec/endpoint/compile_spec.rb +3 -5
  38. data/spec/endpoint/match_spec.rb +10 -12
  39. data/spec/endpoint/placeholders_spec.rb +1 -3
  40. data/spec/endpoint/remove_interpolated_params_spec.rb +2 -3
  41. data/spec/endpoint/values_as_params_spec.rb +2 -4
  42. data/spec/error/find_spec.rb +37 -39
  43. data/spec/error/response_spec.rb +0 -2
  44. data/spec/error/timeout_spec.rb +1 -3
  45. data/spec/interceptors/after_request_spec.rb +2 -4
  46. data/spec/interceptors/after_response_spec.rb +3 -5
  47. data/spec/interceptors/before_request_spec.rb +2 -4
  48. data/spec/interceptors/before_response_spec.rb +2 -4
  49. data/spec/interceptors/default_interceptors_spec.rb +3 -5
  50. data/spec/interceptors/define_spec.rb +4 -6
  51. data/spec/interceptors/response_competition_spec.rb +6 -7
  52. data/spec/interceptors/return_response_spec.rb +8 -11
  53. data/spec/request/encoding_spec.rb +1 -4
  54. data/spec/request/error_handling_spec.rb +13 -2
  55. data/spec/request/headers_spec.rb +1 -2
  56. data/spec/request/option_dup_spec.rb +2 -3
  57. data/spec/request/parallel_requests_spec.rb +2 -2
  58. data/spec/request/url_patterns_spec.rb +4 -5
  59. data/spec/response/body_spec.rb +2 -4
  60. data/spec/response/code_spec.rb +2 -4
  61. data/spec/response/data_spec.rb +2 -4
  62. data/spec/response/effective_url_spec.rb +1 -3
  63. data/spec/response/headers_spec.rb +2 -4
  64. data/spec/response/options_spec.rb +2 -4
  65. data/spec/response/success_spec.rb +2 -3
  66. data/spec/response/time_spec.rb +3 -5
  67. data/spec/spec_helper.rb +1 -1
  68. data/spec/support/reset_config.rb +0 -2
  69. data/spec/timeouts/no_signal_spec.rb +1 -3
  70. data/spec/timeouts/timings_spec.rb +27 -33
  71. metadata +27 -4
  72. data/cider-ci/contexts/rspec.yml +0 -19
  73. data/cider-ci/jobs/tests.yml +0 -27
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,20 +1,18 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Endpoint do
4
-
5
4
  context 'compile' do
6
-
7
5
  it 'uses parameters for interpolation' do
8
- endpoint = LHC::Endpoint.new(':datastore/v2/:campaign_id/feedbacks')
6
+ endpoint = described_class.new(':datastore/v2/:campaign_id/feedbacks')
9
7
  expect(
10
8
  endpoint.compile(datastore: 'http://datastore', campaign_id: 'abc')
11
9
  ).to eq "http://datastore/v2/abc/feedbacks"
12
10
  end
13
11
 
14
12
  it 'uses provided proc to find values' do
15
- endpoint = LHC::Endpoint.new(':datastore/v2')
13
+ endpoint = described_class.new(':datastore/v2')
16
14
  config = { datastore: 'http://datastore' }
17
- find_value = ->(match){
15
+ find_value = lambda { |match|
18
16
  config[match.gsub(':', '').to_sym]
19
17
  }
20
18
  expect(
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Endpoint do
4
-
5
4
  context 'match' do
6
-
7
5
  context 'matching' do
8
6
  it 'checks if a url matches a template' do
9
7
  {
@@ -12,23 +10,23 @@ describe LHC::Endpoint do
12
10
  ':datastore/v2/places/:namespace/:id' => 'http://local.ch:8082/v2/places/switzerland/ZW9OJyrbt'
13
11
  }.each do |template, url|
14
12
  expect(
15
- LHC::Endpoint.match?(url, template)
13
+ described_class.match?(url, template)
16
14
  ).to be, "#{url} should match #{template}!"
17
15
  end
18
16
  end
19
17
  end
20
18
 
21
19
  context 'not matching' do
22
- it 'checks if a url matches a template' do
23
- {
24
- ':datastore/v2/places' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
25
- ':datastore/:campaign_id/feedbacks' => 'http://datastore.local.ch/feedbacks'
26
- }.each do |template, url|
27
- expect(
28
- LHC::Endpoint.match?(url, template)
29
- ).not_to be, "#{url} should not match #{template}!"
30
- end
20
+ it 'checks if a url matches a template' do
21
+ {
22
+ ':datastore/v2/places' => 'http://local.ch:8082/v2/places/ZW9OJyrbt4OZE9ueu80w-A',
23
+ ':datastore/:campaign_id/feedbacks' => 'http://datastore.local.ch/feedbacks'
24
+ }.each do |template, url|
25
+ expect(
26
+ described_class.match?(url, template)
27
+ ).not_to be, "#{url} should not match #{template}!"
31
28
  end
29
+ end
32
30
  end
33
31
  end
34
32
  end
@@ -1,11 +1,9 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Endpoint do
4
-
5
4
  context 'placeholders' do
6
-
7
5
  it 'returns all placeholders alphabetically sorted' do
8
- endpoint = LHC::Endpoint.new(':datastore/v2/:campaign_id/feedbacks')
6
+ endpoint = described_class.new(':datastore/v2/:campaign_id/feedbacks')
9
7
  expect(
10
8
  endpoint.placeholders
11
9
  ).to eq [':campaign_id', ':datastore']
@@ -1,16 +1,15 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Endpoint do
4
-
5
4
  it 'removes params used for interpolation' do
6
5
  params = {
7
6
  datastore: 'http://datastore',
8
7
  campaign_id: 'abc',
9
8
  has_reviews: true
10
9
  }
11
- endpoint = LHC::Endpoint.new(':datastore/v2/:campaign_id/feedbacks')
10
+ endpoint = described_class.new(':datastore/v2/:campaign_id/feedbacks')
12
11
  removed = endpoint.remove_interpolated_params!(params)
13
- expect(params).to eq ({ has_reviews: true })
12
+ expect(params).to eq(has_reviews: true)
14
13
  expect(removed).to eq(datastore: 'http://datastore', campaign_id: 'abc')
15
14
  end
16
15
  end
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Endpoint do
4
-
5
4
  context 'values_as_params' do
6
-
7
5
  it 'provides params extracting values from a provided url and template' do
8
6
  [
9
7
  [':datastore/v2/places', 'http://local.ch:8082/v2/places', {
@@ -17,9 +15,9 @@ describe LHC::Endpoint do
17
15
  datastore: 'http://local.ch:8082',
18
16
  namespace: 'switzerland',
19
17
  id: 'ZW9OJyrbt'
20
- }],
18
+ }]
21
19
  ].each do |example|
22
- params = LHC::Endpoint.values_as_params(example[0], example[1])
20
+ params = described_class.values_as_params(example[0], example[1])
23
21
  expect(params).to eq example[2]
24
22
  end
25
23
  end
@@ -1,56 +1,54 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Error do
4
-
5
4
  def response(code)
6
- LHC::Response.new(OpenStruct.new({code: code}), nil)
5
+ LHC::Response.new(OpenStruct.new(code: code), nil)
7
6
  end
8
7
 
9
8
  context 'find' do
10
-
11
9
  it 'finds error class by status code' do
12
- expect(LHC::Error.find(response('400'))).to eq LHC::BadRequest
13
- expect(LHC::Error.find(response('401'))).to eq LHC::Unauthorized
14
- expect(LHC::Error.find(response('402'))).to eq LHC::PaymentRequired
15
- expect(LHC::Error.find(response('403'))).to eq LHC::Forbidden
16
- expect(LHC::Error.find(response('403'))).to eq LHC::Forbidden
17
- expect(LHC::Error.find(response('404'))).to eq LHC::NotFound
18
- expect(LHC::Error.find(response('405'))).to eq LHC::MethodNotAllowed
19
- expect(LHC::Error.find(response('406'))).to eq LHC::NotAcceptable
20
- expect(LHC::Error.find(response('407'))).to eq LHC::ProxyAuthenticationRequired
21
- expect(LHC::Error.find(response('408'))).to eq LHC::RequestTimeout
22
- expect(LHC::Error.find(response('409'))).to eq LHC::Conflict
23
- expect(LHC::Error.find(response('410'))).to eq LHC::Gone
24
- expect(LHC::Error.find(response('411'))).to eq LHC::LengthRequired
25
- expect(LHC::Error.find(response('412'))).to eq LHC::PreconditionFailed
26
- expect(LHC::Error.find(response('413'))).to eq LHC::RequestEntityTooLarge
27
- expect(LHC::Error.find(response('414'))).to eq LHC::RequestUriToLong
28
- expect(LHC::Error.find(response('415'))).to eq LHC::UnsupportedMediaType
29
- expect(LHC::Error.find(response('416'))).to eq LHC::RequestedRangeNotSatisfiable
30
- expect(LHC::Error.find(response('417'))).to eq LHC::ExpectationFailed
31
- expect(LHC::Error.find(response('422'))).to eq LHC::UnprocessableEntity
32
- expect(LHC::Error.find(response('423'))).to eq LHC::Locked
33
- expect(LHC::Error.find(response('424'))).to eq LHC::FailedDependency
34
- expect(LHC::Error.find(response('426'))).to eq LHC::UpgradeRequired
35
- expect(LHC::Error.find(response('500'))).to eq LHC::InternalServerError
36
- expect(LHC::Error.find(response('501'))).to eq LHC::NotImplemented
37
- expect(LHC::Error.find(response('502'))).to eq LHC::BadGateway
38
- expect(LHC::Error.find(response('503'))).to eq LHC::ServiceUnavailable
39
- expect(LHC::Error.find(response('504'))).to eq LHC::GatewayTimeout
40
- expect(LHC::Error.find(response('505'))).to eq LHC::HttpVersionNotSupported
41
- expect(LHC::Error.find(response('507'))).to eq LHC::InsufficientStorage
42
- expect(LHC::Error.find(response('510'))).to eq LHC::NotExtended
10
+ expect(described_class.find(response('400'))).to eq LHC::BadRequest
11
+ expect(described_class.find(response('401'))).to eq LHC::Unauthorized
12
+ expect(described_class.find(response('402'))).to eq LHC::PaymentRequired
13
+ expect(described_class.find(response('403'))).to eq LHC::Forbidden
14
+ expect(described_class.find(response('403'))).to eq LHC::Forbidden
15
+ expect(described_class.find(response('404'))).to eq LHC::NotFound
16
+ expect(described_class.find(response('405'))).to eq LHC::MethodNotAllowed
17
+ expect(described_class.find(response('406'))).to eq LHC::NotAcceptable
18
+ expect(described_class.find(response('407'))).to eq LHC::ProxyAuthenticationRequired
19
+ expect(described_class.find(response('408'))).to eq LHC::RequestTimeout
20
+ expect(described_class.find(response('409'))).to eq LHC::Conflict
21
+ expect(described_class.find(response('410'))).to eq LHC::Gone
22
+ expect(described_class.find(response('411'))).to eq LHC::LengthRequired
23
+ expect(described_class.find(response('412'))).to eq LHC::PreconditionFailed
24
+ expect(described_class.find(response('413'))).to eq LHC::RequestEntityTooLarge
25
+ expect(described_class.find(response('414'))).to eq LHC::RequestUriToLong
26
+ expect(described_class.find(response('415'))).to eq LHC::UnsupportedMediaType
27
+ expect(described_class.find(response('416'))).to eq LHC::RequestedRangeNotSatisfiable
28
+ expect(described_class.find(response('417'))).to eq LHC::ExpectationFailed
29
+ expect(described_class.find(response('422'))).to eq LHC::UnprocessableEntity
30
+ expect(described_class.find(response('423'))).to eq LHC::Locked
31
+ expect(described_class.find(response('424'))).to eq LHC::FailedDependency
32
+ expect(described_class.find(response('426'))).to eq LHC::UpgradeRequired
33
+ expect(described_class.find(response('500'))).to eq LHC::InternalServerError
34
+ expect(described_class.find(response('501'))).to eq LHC::NotImplemented
35
+ expect(described_class.find(response('502'))).to eq LHC::BadGateway
36
+ expect(described_class.find(response('503'))).to eq LHC::ServiceUnavailable
37
+ expect(described_class.find(response('504'))).to eq LHC::GatewayTimeout
38
+ expect(described_class.find(response('505'))).to eq LHC::HttpVersionNotSupported
39
+ expect(described_class.find(response('507'))).to eq LHC::InsufficientStorage
40
+ expect(described_class.find(response('510'))).to eq LHC::NotExtended
43
41
  end
44
42
 
45
43
  it 'finds error class also by extended status codes' do
46
- expect(LHC::Error.find(response('40001'))).to eq LHC::BadRequest
47
- expect(LHC::Error.find(response('50002'))).to eq LHC::InternalServerError
44
+ expect(described_class.find(response('40001'))).to eq LHC::BadRequest
45
+ expect(described_class.find(response('50002'))).to eq LHC::InternalServerError
48
46
  end
49
47
 
50
48
  it 'returns UnknownError if no specific error was found' do
51
- expect(LHC::Error.find(response('0'))).to eq LHC::UnknownError
52
- expect(LHC::Error.find(response(''))).to eq LHC::UnknownError
53
- expect(LHC::Error.find(response('600'))).to eq LHC::UnknownError
49
+ expect(described_class.find(response('0'))).to eq LHC::UnknownError
50
+ expect(described_class.find(response(''))).to eq LHC::UnknownError
51
+ expect(described_class.find(response('600'))).to eq LHC::UnknownError
54
52
  end
55
53
  end
56
54
  end
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Error do
4
-
5
4
  context 'response' do
6
-
7
5
  it 'throws timeout exception in case of a timeout' do
8
6
  stub_request(:any, 'local.ch').to_return(status: 403)
9
7
  begin
@@ -1,12 +1,10 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC::Error do
4
-
5
4
  context 'timeout' do
6
-
7
5
  it 'throws timeout exception in case of a timeout' do
8
6
  stub_request(:any, 'local.ch').to_timeout
9
- expect(->{
7
+ expect(lambda {
10
8
  LHC.get('local.ch')
11
9
  }).to raise_error LHC::Timeout
12
10
  end
@@ -1,21 +1,19 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'interceptor' do
6
-
7
5
  before(:each) do
8
6
  class SomeInterceptor < LHC::Interceptor
9
7
  def after_request(request)
10
8
  end
11
9
  end
12
- LHC.configure { |c| c.interceptors = [SomeInterceptor] }
10
+ described_class.configure { |c| c.interceptors = [SomeInterceptor] }
13
11
  end
14
12
 
15
13
  it 'can perform some actions after a request was fired' do
16
14
  expect_any_instance_of(SomeInterceptor).to receive(:after_request)
17
15
  stub_request(:get, 'http://local.ch')
18
- LHC.get('http://local.ch')
16
+ described_class.get('http://local.ch')
19
17
  end
20
18
  end
21
19
  end
@@ -1,12 +1,10 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'interceptor' do
6
-
7
5
  before(:each) do
8
6
  class Services
9
- def self.timing(path, time)
7
+ def self.timing(_path, _time)
10
8
  end
11
9
  end
12
10
  end
@@ -27,7 +25,7 @@ describe LHC do
27
25
  Services.timing(path.downcase, response.time)
28
26
  end
29
27
  end
30
- LHC.configure { |c| c.interceptors = [StatsTimingInterceptor] }
28
+ described_class.configure { |c| c.interceptors = [StatsTimingInterceptor] }
31
29
  end
32
30
 
33
31
  let(:url) { "http://local.ch/v2/feedbacks/-Sc4_pYNpqfsudzhtivfkA" }
@@ -35,7 +33,7 @@ describe LHC do
35
33
  it 'can take action after a response was received' do
36
34
  allow(Services).to receive(:timing).with('web.dummy.test.get.http.local.ch.200', 0)
37
35
  stub_request(:get, url)
38
- LHC.get(url)
36
+ described_class.get(url)
39
37
  expect(Services).to have_received(:timing)
40
38
  end
41
39
  end
@@ -1,21 +1,19 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'interceptor' do
6
-
7
5
  before(:each) do
8
6
  class TrackingIdInterceptor < LHC::Interceptor
9
7
  def before_request(request)
10
8
  request.params[:tid] = 123
11
9
  end
12
10
  end
13
- LHC.configure { |c| c.interceptors = [TrackingIdInterceptor] }
11
+ described_class.configure { |c| c.interceptors = [TrackingIdInterceptor] }
14
12
  end
15
13
 
16
14
  it 'can modify requests before they are send' do
17
15
  stub_request(:get, "http://local.ch/?tid=123")
18
- LHC.get('http://local.ch')
16
+ described_class.get('http://local.ch')
19
17
  end
20
18
  end
21
19
  end
@@ -1,21 +1,19 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'interceptor' do
6
-
7
5
  before(:each) do
8
6
  class SomeInterceptor < LHC::Interceptor
9
7
  def before_response(request)
10
8
  end
11
9
  end
12
- LHC.configure { |c| c.interceptors = [SomeInterceptor] }
10
+ described_class.configure { |c| c.interceptors = [SomeInterceptor] }
13
11
  end
14
12
 
15
13
  it 'can perform some actions before a reponse is received' do
16
14
  expect_any_instance_of(SomeInterceptor).to receive(:before_response)
17
15
  stub_request(:get, 'http://local.ch')
18
- LHC.get('http://local.ch')
16
+ described_class.get('http://local.ch')
19
17
  end
20
18
  end
21
19
  end
@@ -1,15 +1,13 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'default interceptors' do
6
-
7
5
  before(:each) do
8
- LHC.configure {}
6
+ described_class.configure {}
9
7
  end
10
8
 
11
- it 'should always return a list for default interceptors' do
12
- expect(LHC.config.interceptors).to eq []
9
+ it 'alwayses return a list for default interceptors' do
10
+ expect(described_class.config.interceptors).to eq []
13
11
  end
14
12
  end
15
13
  end
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'interceptor' do
6
-
7
5
  before(:each) do
8
6
  class SomeInterceptor < LHC::Interceptor
9
7
  end
@@ -12,18 +10,18 @@ describe LHC do
12
10
  end
13
11
 
14
12
  it 'performs interceptor when they are set globally' do
15
- LHC.configure { |c| c.interceptors = [SomeInterceptor] }
13
+ described_class.configure { |c| c.interceptors = [SomeInterceptor] }
16
14
  expect_any_instance_of(SomeInterceptor).to receive(:before_request)
17
15
  stub_request(:get, 'http://local.ch')
18
- LHC.get('http://local.ch')
16
+ described_class.get('http://local.ch')
19
17
  end
20
18
 
21
19
  it 'overrides interceptors on request level' do
22
- LHC.configure { |c| c.interceptors = [SomeInterceptor] }
20
+ described_class.configure { |c| c.interceptors = [SomeInterceptor] }
23
21
  expect_any_instance_of(AnotherInterceptor).to receive(:before_request)
24
22
  expect_any_instance_of(SomeInterceptor).not_to receive(:before_request)
25
23
  stub_request(:get, 'http://local.ch')
26
- LHC.get('http://local.ch', interceptors: [AnotherInterceptor])
24
+ described_class.get('http://local.ch', interceptors: [AnotherInterceptor])
27
25
  end
28
26
  end
29
27
  end
@@ -1,21 +1,20 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'interceptor response competition' do
6
-
7
5
  before(:each) do
8
-
6
+ # rubocop:disable Style/ClassVars
9
7
  class LocalCacheInterceptor < LHC::Interceptor
10
8
  @@cached = false
11
9
  cattr_accessor :cached
12
10
 
13
- def before_request(request)
11
+ def before_request(_request)
14
12
  if @@cached
15
13
  return LHC::Response.new(Typhoeus::Response.new(response_body: 'Im served from local cache'), nil)
16
14
  end
17
15
  end
18
16
  end
17
+ # rubocop:enable Style/ClassVars
19
18
 
20
19
  class RemoteCacheInterceptor < LHC::Interceptor
21
20
 
@@ -26,14 +25,14 @@ describe LHC do
26
25
  end
27
26
  end
28
27
 
29
- LHC.configure { |c| c.interceptors = [LocalCacheInterceptor, RemoteCacheInterceptor] }
28
+ described_class.configure { |c| c.interceptors = [LocalCacheInterceptor, RemoteCacheInterceptor] }
30
29
  end
31
30
 
32
31
  it 'can handle multiple interceptors that compete for returning the response' do
33
- response = LHC.get('http://local.ch')
32
+ response = described_class.get('http://local.ch')
34
33
  expect(response.body).to eq 'Im served from remote cache'
35
34
  LocalCacheInterceptor.cached = true
36
- response = LHC.get('http://local.ch')
35
+ response = described_class.get('http://local.ch')
37
36
  expect(response.body).to eq 'Im served from local cache'
38
37
  end
39
38
  end