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,6 +1,6 @@
1
1
  class LHC::Error < StandardError
2
2
 
3
- attr_accessor :response
3
+ attr_accessor :response, :_message
4
4
 
5
5
  def self.map
6
6
  {
@@ -48,6 +48,7 @@ class LHC::Error < StandardError
48
48
 
49
49
  def initialize(message, response)
50
50
  super(message)
51
+ self._message = message
51
52
  self.response = response
52
53
  end
53
54
 
@@ -58,6 +59,7 @@ class LHC::Error < StandardError
58
59
  debug << "Params: #{request.options}"
59
60
  debug << "Response Code: #{response.code}"
60
61
  debug << response.body
62
+ debug << _message
61
63
  debug.join("\n")
62
64
  end
63
65
  end
@@ -0,0 +1,4 @@
1
+ require File.dirname(__FILE__) + '/../error'
2
+
3
+ class LHC::ParserError < LHC::Error
4
+ end
@@ -1,10 +1,24 @@
1
- module JsonFormat
2
-
1
+ class JsonFormat
3
2
  include LHC::BasicMethods
4
3
 
5
4
  def self.request(options)
6
5
  options[:headers] ||= {}
7
6
  options[:headers]['Content-Type'] = 'application/json'
8
- response = super(options)
7
+ options[:format] = new
8
+ super(options)
9
+ end
10
+
11
+ def parse(response)
12
+ JSON.parse(response.body, object_class: OpenStruct)
13
+ rescue JSON::ParserError => e
14
+ raise LHC::ParserError.new(e.message, response)
15
+ end
16
+
17
+ def to_s
18
+ 'json'
19
+ end
20
+
21
+ def to_sym
22
+ to_s.to_sym
9
23
  end
10
- end
24
+ end
@@ -1,9 +1,11 @@
1
1
  class LHC::Interceptor
2
2
 
3
3
  def before_request(request); end
4
+
4
5
  def after_request(request); end
5
6
 
6
7
  def before_response(request); end
8
+
7
9
  def after_response(response); end
8
10
 
9
11
  end
@@ -7,7 +7,7 @@ class LHC::InterceptorProcessor
7
7
  def initialize(target)
8
8
  options = target.options if target.is_a? LHC::Request
9
9
  options ||= target.request.options if target.is_a? LHC::Response
10
- self.interceptors = (options[:interceptors] || LHC.config.interceptors).map{ |i| i.new }
10
+ self.interceptors = (options[:interceptors] || LHC.config.interceptors).map { |i| i.new }
11
11
  end
12
12
 
13
13
  # Forwards messages to interceptors and handles provided responses.
@@ -9,7 +9,7 @@ class LHC::Request
9
9
 
10
10
  TYPHOEUS_OPTIONS = [:params, :method, :body, :headers, :follow_location]
11
11
 
12
- attr_accessor :response, :options, :raw
12
+ attr_accessor :response, :options, :raw, :format
13
13
 
14
14
  def initialize(options, self_executing = true)
15
15
  self.options = options.deep_dup || {}
@@ -17,6 +17,7 @@ class LHC::Request
17
17
  generate_url_from_template!
18
18
  self.iprocessor = LHC::InterceptorProcessor.new(self)
19
19
  self.raw = create_request
20
+ self.format = options.delete('format') || JsonFormat.new
20
21
  iprocessor.intercept(:before_request, self)
21
22
  raw.run if self_executing && !response
22
23
  end
@@ -60,7 +61,7 @@ class LHC::Request
60
61
  options = options.deep_dup
61
62
  easy = Ethon::Easy.new
62
63
  options.delete(:url)
63
- options.each do |key, v|
64
+ options.each do |key, _v|
64
65
  next if TYPHOEUS_OPTIONS.include? key
65
66
  method = "#{key}="
66
67
  options.delete key unless easy.respond_to?(method)
@@ -71,23 +72,24 @@ class LHC::Request
71
72
  # Get configured endpoint and use it for doing the request.
72
73
  # Explicit request options are overriding configured options.
73
74
  def use_configured_endpoint!
74
- endpoint = LHC.config.endpoints[self.options[:url]]
75
+ endpoint = LHC.config.endpoints[options[:url]]
75
76
  return unless endpoint
76
77
  # explicit options override endpoint options
77
- new_options = endpoint.options.deep_merge(self.options)
78
+ new_options = endpoint.options.deep_merge(options)
78
79
  # set new options
79
80
  self.options = new_options
80
- self.options[:url] = endpoint.url
81
+ options[:url] = endpoint.url
81
82
  end
82
83
 
83
84
  # Generates URL from a URL template
84
85
  def generate_url_from_template!
85
86
  endpoint = LHC::Endpoint.new(options[:url])
86
- params = if options[:body] && options[:body].length && (options[:headers] || {}).fetch('Content-Type', nil) == 'application/json'
87
- JSON.parse(options[:body]).merge(options[:params] || {}).deep_symbolize_keys
88
- else
89
- options[:params]
90
- end
87
+ params =
88
+ if options[:body] && options[:body].length && (options[:headers] || {}).fetch('Content-Type', nil) == 'application/json'
89
+ JSON.parse(options[:body]).merge(options[:params] || {}).deep_symbolize_keys
90
+ else
91
+ options[:params]
92
+ end
91
93
  options[:url] = endpoint.compile(params)
92
94
  endpoint.remove_interpolated_params!(options[:params])
93
95
  end
@@ -16,12 +16,7 @@ class LHC::Response
16
16
  # Access response data.
17
17
  # Cache parsing.
18
18
  def data
19
- @data ||= case format
20
- when :json
21
- JSON.parse(raw.body, object_class: OpenStruct)
22
- else # default is json
23
- JSON.parse(raw.body, object_class: OpenStruct)
24
- end
19
+ @data ||= format.parse(self)
25
20
  @data
26
21
  end
27
22
 
@@ -63,9 +58,8 @@ class LHC::Response
63
58
  attr_accessor :raw
64
59
 
65
60
  def format
66
- headers = {}
67
- headers = request.options.fetch(:headers, {}) if request && request.options
68
- return :json if headers['Content-Type'] == 'application/json'
61
+ return JsonFormat.new if request.nil?
62
+ request.format
69
63
  end
70
64
 
71
65
  end
@@ -1,3 +1,3 @@
1
1
  module LHC
2
- VERSION = "3.4.0"
2
+ VERSION = "3.5.0"
3
3
  end
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe LHC::Request do
4
4
  before do
5
- allow_any_instance_of(LHC::Request).to receive(:use_configured_endpoint!)
6
- allow_any_instance_of(LHC::Request).to receive(:generate_url_from_template!)
5
+ allow_any_instance_of(described_class).to receive(:use_configured_endpoint!)
6
+ allow_any_instance_of(described_class).to receive(:generate_url_from_template!)
7
7
  end
8
8
  context 'request without rails' do
9
9
  it 'does have deep_merge dependency met' do
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'delete' do
6
-
7
5
  let(:feedback) do
8
6
  {
9
7
  recommended: true,
@@ -14,20 +12,20 @@ describe LHC do
14
12
 
15
13
  before(:each) do
16
14
  stub_request(:delete, "http://datastore/v2/feedbacks/12121")
17
- .to_return(status: 200, body: feedback.to_json, headers: {'Content-Encoding' => 'UTF-8'})
15
+ .to_return(status: 200, body: feedback.to_json, headers: { 'Content-Encoding' => 'UTF-8' })
18
16
  end
19
17
 
20
18
  it 'does a delete request when providing a complete url' do
21
- LHC.delete('http://datastore/v2/feedbacks/12121')
19
+ described_class.delete('http://datastore/v2/feedbacks/12121')
22
20
  end
23
21
 
24
22
  it 'it makes response data available in a rails way' do
25
- response = LHC.delete('http://datastore/v2/feedbacks/12121')
23
+ response = described_class.delete('http://datastore/v2/feedbacks/12121')
26
24
  expect(response.data.recommended).to eq true
27
25
  end
28
26
 
29
27
  it 'provides response headers' do
30
- response = LHC.delete('http://datastore/v2/feedbacks/12121')
28
+ response = described_class.delete('http://datastore/v2/feedbacks/12121')
31
29
  expect(response.headers).to be
32
30
  end
33
31
  end
@@ -1,12 +1,10 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'get' do
6
-
7
5
  before(:each) do
8
6
  stub_request(:get, 'http://datastore/v2/feedbacks?has_reviews=true')
9
- .to_return(status: 200, body: { total: 99 }.to_json, headers: {'Content-Encoding' => 'UTF-8'})
7
+ .to_return(status: 200, body: { total: 99 }.to_json, headers: { 'Content-Encoding' => 'UTF-8' })
10
8
  end
11
9
 
12
10
  let(:parameters) do
@@ -36,10 +34,9 @@ describe LHC do
36
34
  end
37
35
 
38
36
  context 'get json' do
39
-
40
37
  before(:each) do
41
- stub_request(:get, 'http://datastore/v2/feedbacks').with(headers: {'Content-Type' => 'application/json'})
42
- .to_return(body: {some: 'json'}.to_json)
38
+ stub_request(:get, 'http://datastore/v2/feedbacks').with(headers: { 'Content-Type' => 'application/json' })
39
+ .to_return(body: { some: 'json' }.to_json)
43
40
  end
44
41
 
45
42
  it 'requests json and parses response body' do
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'post' do
6
-
7
5
  let(:feedback) do
8
6
  {
9
7
  recommended: true,
@@ -14,28 +12,28 @@ describe LHC do
14
12
 
15
13
  before(:each) do
16
14
  stub_request(:post, "http://datastore/v2/feedbacks")
17
- .with(body: feedback.to_json)
18
- .to_return(status: 200, body: feedback.to_json, headers: {'Content-Encoding' => 'UTF-8'})
15
+ .with(body: feedback.to_json)
16
+ .to_return(status: 200, body: feedback.to_json, headers: { 'Content-Encoding' => 'UTF-8' })
19
17
  end
20
18
 
21
19
  it 'does a post request when providing a complete url' do
22
- LHC.post('http://datastore/v2/feedbacks', body: feedback.to_json)
20
+ described_class.post('http://datastore/v2/feedbacks', body: feedback.to_json)
23
21
  end
24
22
 
25
23
  it 'does a post request when providing the name of a configured endpoint' do
26
24
  url = 'http://:datastore/v2/feedbacks'
27
25
  options = { params: { datastore: 'datastore' } }
28
- LHC.configure { |c| c.endpoint(:feedbacks, url, options) }
29
- LHC.post(:feedbacks, body: feedback.to_json)
26
+ described_class.configure { |c| c.endpoint(:feedbacks, url, options) }
27
+ described_class.post(:feedbacks, body: feedback.to_json)
30
28
  end
31
29
 
32
30
  it 'it makes response data available in a rails way' do
33
- response = LHC.post('http://datastore/v2/feedbacks', body: feedback.to_json)
31
+ response = described_class.post('http://datastore/v2/feedbacks', body: feedback.to_json)
34
32
  expect(response.data.source_id).to eq 'aaa'
35
33
  end
36
34
 
37
35
  it 'provides response headers' do
38
- response = LHC.post('http://datastore/v2/feedbacks', body: feedback.to_json)
36
+ response = described_class.post('http://datastore/v2/feedbacks', body: feedback.to_json)
39
37
  expect(response.headers).to be
40
38
  end
41
39
  end
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'post' do
6
-
7
5
  let(:feedback) do
8
6
  {
9
7
  recommended: false,
@@ -20,28 +18,28 @@ describe LHC do
20
18
 
21
19
  before(:each) do
22
20
  stub_request(:put, "http://datastore/v2/feedbacks")
23
- .with(body: change.to_json)
24
- .to_return(status: 200, body: feedback.merge(change).to_json, headers: {'Content-Encoding' => 'UTF-8'})
21
+ .with(body: change.to_json)
22
+ .to_return(status: 200, body: feedback.merge(change).to_json, headers: { 'Content-Encoding' => 'UTF-8' })
25
23
  end
26
24
 
27
25
  it 'does a post request when providing a complete url' do
28
- LHC.put('http://datastore/v2/feedbacks', body: change.to_json)
26
+ described_class.put('http://datastore/v2/feedbacks', body: change.to_json)
29
27
  end
30
28
 
31
29
  it 'does a post request when providing the name of a configured endpoint' do
32
30
  url = 'http://:datastore/v2/feedbacks'
33
31
  options = { params: { datastore: 'datastore' } }
34
- LHC.configure { |c| c.endpoint(:feedbacks, url, options) }
35
- LHC.put(:feedbacks, body: change.to_json)
32
+ described_class.configure { |c| c.endpoint(:feedbacks, url, options) }
33
+ described_class.put(:feedbacks, body: change.to_json)
36
34
  end
37
35
 
38
36
  it 'it makes response data available in a rails way' do
39
- response = LHC.put('http://datastore/v2/feedbacks', body: change.to_json)
37
+ response = described_class.put('http://datastore/v2/feedbacks', body: change.to_json)
40
38
  expect(response.data.recommended).to eq false
41
39
  end
42
40
 
43
41
  it 'provides response headers' do
44
- response = LHC.put('http://datastore/v2/feedbacks', body: change.to_json)
42
+ response = described_class.put('http://datastore/v2/feedbacks', body: change.to_json)
45
43
  expect(response.headers).to be
46
44
  end
47
45
  end
@@ -1,18 +1,16 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'request' do
6
-
7
5
  let(:total) { 99 }
8
6
 
9
7
  before(:each) do
10
8
  stub_request(:get, "http://datastore/v2/feedbacks?has_reviews=true")
11
- .to_return(status: 200, body: { total: total }.to_json, headers: {'Content-Encoding' => 'UTF-8'})
9
+ .to_return(status: 200, body: { total: total }.to_json, headers: { 'Content-Encoding' => 'UTF-8' })
12
10
  end
13
11
 
14
12
  it 'does a request returning a response' do
15
- response = LHC.request(url: 'http://datastore/v2/feedbacks', params: { has_reviews: true }, method: :get)
13
+ response = described_class.request(url: 'http://datastore/v2/feedbacks', params: { has_reviews: true }, method: :get)
16
14
  expect(response.data.total).to eq total
17
15
  end
18
16
  end
@@ -1,9 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'configured endpoints' do
6
-
7
5
  let(:url) { 'http://analytics/track/:entity_id/w/:type' }
8
6
 
9
7
  let(:options) do
@@ -14,51 +12,50 @@ describe LHC do
14
12
  end
15
13
 
16
14
  before(:each) do
17
- LHC.configure do |c|
15
+ described_class.configure do |c|
18
16
  c.endpoint(:kpi_tracker, url, options)
19
17
  end
20
18
  end
21
19
 
22
20
  it 'configures urls to be able to access them by name later' do
23
- expect(LHC.config.endpoints[:kpi_tracker].url).to eq url
24
- expect(LHC.config.endpoints[:kpi_tracker].options).to eq options
21
+ expect(described_class.config.endpoints[:kpi_tracker].url).to eq url
22
+ expect(described_class.config.endpoints[:kpi_tracker].options).to eq options
25
23
  end
26
24
 
27
25
  it 'compile url' do
28
26
  stub_request(:get, 'http://analytics/track/123/w/request?env=PROD')
29
- response = LHC.get(:kpi_tracker, params: { entity_id: 123, type: 'request' })
27
+ response = described_class.get(:kpi_tracker, params: { entity_id: 123, type: 'request' })
30
28
  expect(response.request.options[:followlocation]).to eq false
31
29
  end
32
30
 
33
31
  it 'gets overwritten by explicit request options' do
34
32
  stub_request(:get, 'http://analytics/track/123/w/request?env=STG')
35
- response = LHC.get(:kpi_tracker, params: { entity_id: 123, type: 'request', env: 'STG' })
33
+ described_class.get(:kpi_tracker, params: { entity_id: 123, type: 'request', env: 'STG' })
36
34
  end
37
35
 
38
36
  it 'raises in case of claching endpoint names' do
39
- expect(->{
40
- LHC.config.endpoint(:kpi_tracker, 'http://kpi-tracker')
37
+ expect(lambda {
38
+ described_class.config.endpoint(:kpi_tracker, 'http://kpi-tracker')
41
39
  }).to raise_error 'Endpoint already exists for that name'
42
40
  end
43
41
 
44
42
  it 'enforces endpoint name to be a symbol' do
45
- LHC.configure { |c| c.endpoint('datastore', 'http://datastore') }
46
- expect(LHC.config.endpoints[:datastore].url).to eq 'http://datastore'
43
+ described_class.configure { |c| c.endpoint('datastore', 'http://datastore') }
44
+ expect(described_class.config.endpoints[:datastore].url).to eq 'http://datastore'
47
45
  end
48
46
  end
49
47
 
50
48
  context 'configured enpoints with default params' do
51
-
52
49
  before(:each) do
53
- LHC.config.endpoint(:telemarketers, 'http://datastore/v2/spamnumbers?order_by=-user_frequency&swiss_number=true&offset=0&limit=:limit', params: { limit: 200 })
50
+ described_class.config.endpoint(:telemarketers, 'http://datastore/v2/spamnumbers?order_by=-user_frequency&swiss_number=true&offset=0&limit=:limit', params: { limit: 200 })
54
51
  stub_request(:get, 'http://datastore/v2/spamnumbers?limit=200&offset=0&order_by=-user_frequency&swiss_number=true')
55
52
  .to_return(status: 200)
56
53
  end
57
54
 
58
55
  it 'is possible to call them multiple times with default params' do
59
- LHC.get(:telemarketers)
60
- LHC.get(:telemarketers)
61
- LHC.get(:telemarketers)
56
+ described_class.get(:telemarketers)
57
+ described_class.get(:telemarketers)
58
+ described_class.get(:telemarketers)
62
59
  end
63
60
  end
64
61
  end
@@ -1,32 +1,30 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe LHC do
4
-
5
4
  context 'configuration of placeholders' do
6
-
7
5
  it 'uses values for placeholders defined globally' do
8
- LHC.configure { |c| c.placeholder(:datastore, 'http://datastore/v2') }
6
+ described_class.configure { |c| c.placeholder(:datastore, 'http://datastore/v2') }
9
7
  stub_request(:get, "http://datastore/v2/feedbacks")
10
- LHC.get(':datastore/feedbacks')
8
+ described_class.get(':datastore/feedbacks')
11
9
  end
12
10
 
13
11
  it 'uses explicit values first' do
14
- LHC.configure {|c| c.placeholder(:campaign_id, '123') }
12
+ described_class.configure { |c| c.placeholder(:campaign_id, '123') }
15
13
  stub_request(:get, 'http://datastore/v2/campaign/456/feedbacks')
16
14
  url = 'http://datastore/v2/campaign/:campaign_id/feedbacks'
17
- LHC.get(url, params: { campaign_id: '456' })
15
+ described_class.get(url, params: { campaign_id: '456' })
18
16
  end
19
17
 
20
18
  it 'raises in case of claching placeholder name' do
21
- LHC.configure { |c| c.placeholder(:datastore, 'http://datastore') }
22
- expect(->{
23
- LHC.config.placeholder(:datastore, 'http://datastore')
19
+ described_class.configure { |c| c.placeholder(:datastore, 'http://datastore') }
20
+ expect(lambda {
21
+ described_class.config.placeholder(:datastore, 'http://datastore')
24
22
  }).to raise_error 'Placeholder already exists for that name'
25
23
  end
26
24
 
27
25
  it 'enforces placeholder name to be a symbol' do
28
- LHC.configure { |c| c.placeholder('datatore', 'http://datastore') }
29
- expect(LHC.config.placeholders[:datatore]).to eq 'http://datastore'
26
+ described_class.configure { |c| c.placeholder('datatore', 'http://datastore') }
27
+ expect(described_class.config.placeholders[:datatore]).to eq 'http://datastore'
30
28
  end
31
29
  end
32
30
  end