lhc-core-interceptors 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.localch.yml +190 -0
- data/.rubocop.yml +21 -0
- data/README.md +15 -0
- data/cider-ci/jobs/rspec.yml +48 -0
- data/cider-ci/jobs/rubocop.yml +55 -0
- data/cider-ci/scripts/bundle.yml +3 -0
- data/cider-ci/scripts/github_comment.yml +6 -0
- data/cider-ci/scripts/rspec.yml +4 -0
- data/cider-ci/scripts/rubocop.yml +5 -0
- data/cider-ci/scripts/ruby-version.yml +2 -0
- data/cider-ci/scripts/tmp-cache.yml +2 -0
- data/cider-ci.yml +2 -1
- data/lhc-core-interceptors.gemspec +1 -0
- data/lib/lhc-core-interceptors/auth.rb +25 -3
- data/lib/lhc-core-interceptors/monitoring.rb +1 -1
- data/lib/lhc-core-interceptors/version.rb +1 -1
- data/spec/auth/basic_auth_spec.rb +15 -0
- data/spec/auth/bearer_spec.rb +2 -4
- data/spec/caching/main_spec.rb +3 -5
- data/spec/caching/parameters_spec.rb +1 -3
- data/spec/caching/response_status_spec.rb +0 -1
- data/spec/caching/to_cache_spec.rb +4 -7
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/config/initializers/cookies_serializer.rb +1 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/monitoring/main_spec.rb +5 -7
- data/spec/spec_helper.rb +1 -1
- data/spec/support/cleanup_configuration.rb +0 -2
- metadata +28 -4
- data/cider-ci/contexts/rspec.yml +0 -16
- data/cider-ci/jobs/tests.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199dcad392ac88c77807b144fa9ff615514ba3d9
|
4
|
+
data.tar.gz: 62ee867af574146bc8d9033e6d82a2dbce4d1e3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4817c6e276fc7867f801f6795054e0c1dbf56ad99f00ca4fbb9ec2ac68a9a3b3709ab11762af1a71e29c4b7d1dd0f4977953a80e252b3bc10dd3a78f0ae027f
|
7
|
+
data.tar.gz: bce436de74efa7be5a67bb96457aa99402b035294aa88f2f97b45645b4d2b4ed26f616ec63fee1fedc00b75f6c7622c3669215541b7576df865075eea6314baf
|
@@ -0,0 +1,190 @@
|
|
1
|
+
# This is master rubocop configuration.
|
2
|
+
# DO NOT EDIT THIS FILE - it WILL be overwriten on every config update
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.1
|
5
|
+
DisplayCopNames: true
|
6
|
+
DisplayStyleGuide: true
|
7
|
+
Include:
|
8
|
+
- '**/Rakefile'
|
9
|
+
- '**/config.ru'
|
10
|
+
- '**/Capfile'
|
11
|
+
Exclude:
|
12
|
+
- 'db/**/*'
|
13
|
+
- 'script/**/*'
|
14
|
+
- 'vendor/bundle/**/*'
|
15
|
+
- 'bin/**/*'
|
16
|
+
- 'config/unicorn.rb'
|
17
|
+
- 'config/compass.rb'
|
18
|
+
- 'Rakefile'
|
19
|
+
|
20
|
+
Rails:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
require:
|
24
|
+
- rubocop-rspec
|
25
|
+
|
26
|
+
Lint/HandleExceptions:
|
27
|
+
Exclude:
|
28
|
+
- spec/**/*
|
29
|
+
|
30
|
+
Metrics/LineLength:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Metrics/AbcSize:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Metrics/MethodLength:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Metrics/CyclomaticComplexity:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/PerceivedComplexity:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Metrics/ClassLength:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Metrics/ModuleLength:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Metrics/ParameterLists:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Metrics/BlockNesting:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Performance/StringReplacement:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Performance/TimesMap:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Performance/RedundantBlockCall:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Performance/RedundantMatch:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Performance/RedundantMerge:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
Performance/Casecmp:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/MultilineOperationIndentation:
|
76
|
+
EnforcedStyle: indented
|
77
|
+
|
78
|
+
Style/StringLiterals:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Style/RegexpLiteral:
|
82
|
+
Exclude:
|
83
|
+
- spec/**/*
|
84
|
+
|
85
|
+
Style/DotPosition:
|
86
|
+
EnforcedStyle: leading
|
87
|
+
|
88
|
+
Style/AlignParameters:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Style/NumericLiterals:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
Style/WordArray:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Style/EmptyLinesAroundClassBody:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
Style/Next:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
Style/PercentLiteralDelimiters:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
Style/GlobalVars:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
Style/CommentAnnotation:
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
Style/SymbolProc:
|
113
|
+
Enabled: false
|
114
|
+
|
115
|
+
Style/DoubleNegation:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
Style/FormatString:
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
Style/AsciiComments:
|
122
|
+
Enabled: false
|
123
|
+
|
124
|
+
Style/BarePercentLiterals:
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
Style/SingleLineBlockParams:
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
Style/MultilineBlockChain:
|
131
|
+
Enabled: false
|
132
|
+
|
133
|
+
Style/UnneededCapitalW:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
Style/UnneededPercentQ:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
Style/BlockDelimiters:
|
140
|
+
Exclude:
|
141
|
+
- spec/**/*
|
142
|
+
|
143
|
+
Style/BracesAroundHashParameters:
|
144
|
+
EnforcedStyle: context_dependent
|
145
|
+
|
146
|
+
Style/IfUnlessModifier:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
Style/ClassAndModuleChildren:
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Style/Documentation:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Style/GuardClause:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Style/AccessorMethodName:
|
159
|
+
Exclude:
|
160
|
+
- spec/support/pages/**/*
|
161
|
+
|
162
|
+
Style/NegatedIf:
|
163
|
+
Enabled: false
|
164
|
+
|
165
|
+
Style/MutableConstant:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
Style/ConditionalAssignment:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
Style/IndentArray:
|
172
|
+
EnforcedStyle: consistent
|
173
|
+
|
174
|
+
Style/MultilineMethodCallIndentation:
|
175
|
+
EnforcedStyle: indented
|
176
|
+
|
177
|
+
RSpec/DescribeClass:
|
178
|
+
Exclude:
|
179
|
+
- spec/views/**/*
|
180
|
+
- spec/routing/**/*
|
181
|
+
- spec/requests/**/*
|
182
|
+
- spec/features/**/*
|
183
|
+
|
184
|
+
RSpec/FilePath:
|
185
|
+
Enabled: false
|
186
|
+
|
187
|
+
Rails/Output:
|
188
|
+
Exclude:
|
189
|
+
- 'config/application.rb'
|
190
|
+
- 'config/initializers/asset_manifest_warning.rb'
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# This is project specific rubocop configuration file.
|
2
|
+
# You can tweak project settings here
|
3
|
+
inherit_from:
|
4
|
+
- ./.rubocop.localch.yml
|
5
|
+
|
6
|
+
Lint/IneffectiveAccessModifier:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
RSpec/DescribedClass:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Style/FileName:
|
13
|
+
Exclude:
|
14
|
+
- lib/lhc-core-interceptors.rb
|
15
|
+
|
16
|
+
RSpec/DescribedClass:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
RSpec/AnyInstance:
|
20
|
+
Enabled: false
|
21
|
+
|
data/README.md
CHANGED
@@ -96,6 +96,8 @@ Add the auth interceptor to your basic set of LHC interceptors.
|
|
96
96
|
LHC.config.interceptors = [LHC::Auth]
|
97
97
|
```
|
98
98
|
|
99
|
+
#### Bearer Authentication
|
100
|
+
|
99
101
|
```ruby
|
100
102
|
LHC.get('http://local.ch', auth: { bearer: -> { access_token } })
|
101
103
|
```
|
@@ -106,3 +108,16 @@ Adds the following header to the request:
|
|
106
108
|
```
|
107
109
|
|
108
110
|
Assuming the method `access_token` responds on runtime of the request with `123456`.
|
111
|
+
|
112
|
+
#### Basic Authentication
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
LHC.get('http://local.ch', auth: { basic: -> { username: 'steve', password: 'can' } })
|
116
|
+
```
|
117
|
+
|
118
|
+
Adds the following header to the request:
|
119
|
+
```
|
120
|
+
'Authorization': 'Basic c3RldmU6Y2Fu'
|
121
|
+
```
|
122
|
+
|
123
|
+
Which is the base64 encoded credentials "username:password".
|
@@ -0,0 +1,48 @@
|
|
1
|
+
rspec:
|
2
|
+
name: 'RSPec tests'
|
3
|
+
|
4
|
+
run-on:
|
5
|
+
- type: branch
|
6
|
+
include-match: ^.*$
|
7
|
+
|
8
|
+
context:
|
9
|
+
task-defaults:
|
10
|
+
ports:
|
11
|
+
CAPYBARA_PORT:
|
12
|
+
inet_address: "localhost"
|
13
|
+
min: 8000
|
14
|
+
max: 8999
|
15
|
+
PHANTOMJS_PORT:
|
16
|
+
inet_address: "localhost"
|
17
|
+
min: 44600
|
18
|
+
max: 44999
|
19
|
+
|
20
|
+
scripts:
|
21
|
+
rspec:
|
22
|
+
start-when:
|
23
|
+
- script: bundle
|
24
|
+
- script: ruby-version
|
25
|
+
- script: tmp-cache
|
26
|
+
|
27
|
+
|
28
|
+
_cider-ci_include:
|
29
|
+
- cider-ci/scripts/bundle.yml
|
30
|
+
- cider-ci/scripts/tmp-cache.yml
|
31
|
+
- cider-ci/scripts/ruby-version.yml
|
32
|
+
- cider-ci/scripts/rspec.yml
|
33
|
+
|
34
|
+
|
35
|
+
trial-attachments:
|
36
|
+
logs:
|
37
|
+
include-match: log\/.*\.log$
|
38
|
+
content-type: text/plain
|
39
|
+
image-screenshots:
|
40
|
+
include-match: tmp\/capybara\/.*\.png$
|
41
|
+
content-type: image/png
|
42
|
+
html-screenshots:
|
43
|
+
include-match: tmp\/capybara\/.*\.html$
|
44
|
+
content-type: text/html
|
45
|
+
|
46
|
+
_cider-ci_generate-tasks:
|
47
|
+
include-match: spec/.*_spec.rb
|
48
|
+
exclude-match: spec/support/shared/*
|
@@ -0,0 +1,55 @@
|
|
1
|
+
rubocop:
|
2
|
+
name: 'Rubocop analysis'
|
3
|
+
|
4
|
+
run-on:
|
5
|
+
- type: branch
|
6
|
+
include-match: ^.*$
|
7
|
+
|
8
|
+
context:
|
9
|
+
task-defaults:
|
10
|
+
environment-variables:
|
11
|
+
GIT_REPOSITORY: local-ch/location-app
|
12
|
+
RESULT_PATH: 'tmp/checkstyle.json'
|
13
|
+
|
14
|
+
scripts:
|
15
|
+
rubocop:
|
16
|
+
start-when:
|
17
|
+
- script: bundle
|
18
|
+
- script: ruby-version
|
19
|
+
- script: tmp-cache
|
20
|
+
|
21
|
+
|
22
|
+
github_comment:
|
23
|
+
start-when:
|
24
|
+
- script: rubocop
|
25
|
+
states: [failed]
|
26
|
+
|
27
|
+
|
28
|
+
_cider-ci_include:
|
29
|
+
- cider-ci/scripts/bundle.yml
|
30
|
+
- cider-ci/scripts/tmp-cache.yml
|
31
|
+
- cider-ci/scripts/ruby-version.yml
|
32
|
+
- cider-ci/scripts/rubocop.yml
|
33
|
+
|
34
|
+
- cider-ci/scripts/github_comment.yml
|
35
|
+
|
36
|
+
|
37
|
+
max-auto-trials: 1
|
38
|
+
|
39
|
+
trial-attachments:
|
40
|
+
logs:
|
41
|
+
include-match: tmp\/checkstyle.json$
|
42
|
+
content-type: application/json
|
43
|
+
|
44
|
+
tree-attachments:
|
45
|
+
logs:
|
46
|
+
include-match: tmp\/checkstyle.json$
|
47
|
+
content-type: application/json
|
48
|
+
|
49
|
+
tasks:
|
50
|
+
rubocop:
|
51
|
+
scripts:
|
52
|
+
rubocop: {}
|
53
|
+
|
54
|
+
github_comment: {}
|
55
|
+
|
data/cider-ci.yml
CHANGED
@@ -2,10 +2,32 @@ class LHC::Auth < LHC::Interceptor
|
|
2
2
|
|
3
3
|
def before_request(request)
|
4
4
|
options = request.options[:auth] || {}
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
authenticate!(request, options)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def authenticate!(request, options)
|
11
|
+
if options[:bearer]
|
12
|
+
bearer_authentication!(request, options)
|
13
|
+
elsif options[:basic]
|
14
|
+
basic_authentication!(request, options)
|
8
15
|
end
|
9
16
|
end
|
10
17
|
|
18
|
+
def basic_authentication!(request, options)
|
19
|
+
auth = options[:basic]
|
20
|
+
credentials = "#{auth[:username]}:#{auth[:password]}"
|
21
|
+
set_authorization_header request, "Basic #{Base64.encode64(credentials).chomp}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def bearer_authentication!(request, options)
|
25
|
+
token = options[:bearer]
|
26
|
+
token = token.call if token.is_a?(Proc)
|
27
|
+
set_authorization_header request, "Bearer #{token}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_authorization_header(request, value)
|
31
|
+
request.headers['Authorization'] = value
|
32
|
+
end
|
11
33
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe LHC::Auth do
|
4
|
+
before(:each) do
|
5
|
+
LHC.config.interceptors = [LHC::Auth]
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'adds basic auth to every request' do
|
9
|
+
options = { basic: { username: 'steve', password: 'can' } }
|
10
|
+
LHC.config.endpoint(:local, 'http://local.ch', auth: options)
|
11
|
+
stub_request(:get, 'http://local.ch')
|
12
|
+
.with(headers: { 'Authorization' => 'Basic c3RldmU6Y2Fu' })
|
13
|
+
LHC.get(:local)
|
14
|
+
end
|
15
|
+
end
|
data/spec/auth/bearer_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe LHC::Auth do
|
4
|
-
|
5
4
|
before(:each) do
|
6
5
|
LHC.config.interceptors = [LHC::Auth]
|
7
6
|
end
|
@@ -10,10 +9,9 @@ describe LHC::Auth do
|
|
10
9
|
def bearer_token
|
11
10
|
'123456'
|
12
11
|
end
|
13
|
-
options = { bearer: ->{ bearer_token } }
|
12
|
+
options = { bearer: -> { bearer_token } }
|
14
13
|
LHC.config.endpoint(:local, 'http://local.ch', auth: options)
|
15
|
-
stub_request(:get, 'http://local.ch').with(headers: { 'Authorization' => 'Bearer 123456'})
|
14
|
+
stub_request(:get, 'http://local.ch').with(headers: { 'Authorization' => 'Bearer 123456' })
|
16
15
|
LHC.get(:local)
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
data/spec/caching/main_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe LHC::Caching do
|
4
|
-
|
5
4
|
before(:each) do
|
6
5
|
LHC.config.interceptors = [LHC::Caching]
|
7
6
|
Rails.cache.clear
|
@@ -14,13 +13,13 @@ describe LHC::Caching do
|
|
14
13
|
LHC.config.endpoint(:local, 'http://local.ch', cache: true, cache_expires_in: 5.minutes)
|
15
14
|
expect(Rails.cache).to receive(:write)
|
16
15
|
.with(
|
17
|
-
"LHC_CACHE(v#{LHC::Caching::CACHE_VERSION}): GET http://local.ch",
|
16
|
+
"LHC_CACHE(v#{LHC::Caching::CACHE_VERSION}): GET http://local.ch",
|
18
17
|
{
|
19
18
|
body: 'The Website',
|
20
19
|
code: 200,
|
21
20
|
headers: nil,
|
22
21
|
return_code: nil
|
23
|
-
}, expires_in: 5.minutes
|
22
|
+
}, { expires_in: 5.minutes }
|
24
23
|
)
|
25
24
|
.and_call_original
|
26
25
|
original_response = LHC.get(:local)
|
@@ -52,10 +51,9 @@ describe LHC::Caching do
|
|
52
51
|
it 'does not store server errors in cache' do
|
53
52
|
LHC.config.endpoint(:local, 'http://local.ch', cache: true)
|
54
53
|
stub_request(:get, 'http://local.ch').to_return(status: 500, body: 'ERROR')
|
55
|
-
expect{ LHC.get(:local) }.to raise_error LHC::ServerError
|
54
|
+
expect { LHC.get(:local) }.to raise_error LHC::ServerError
|
56
55
|
stub
|
57
56
|
expect(Rails.cache).to receive(:write).once
|
58
57
|
LHC.get(:local)
|
59
58
|
end
|
60
|
-
|
61
59
|
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe LHC::Caching do
|
4
|
-
|
5
4
|
context 'parameters' do
|
6
|
-
|
7
5
|
before(:each) do
|
8
6
|
LHC.config.interceptors = [LHC::Caching]
|
9
7
|
Rails.cache.clear
|
@@ -21,4 +19,4 @@ describe LHC::Caching do
|
|
21
19
|
).to eq 'The Website for Zuerich'
|
22
20
|
end
|
23
21
|
end
|
24
|
-
end
|
22
|
+
end
|
@@ -1,17 +1,14 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe LHC::Caching do
|
4
|
-
|
5
4
|
context 'to_cache' do
|
6
|
-
|
7
5
|
it 'returns a marshalable object to store in the cache' do
|
8
6
|
expect do
|
7
|
+
response = Typhoeus::Response.new(headers: { 'Accept' => 'application/json' })
|
9
8
|
Marshal.dump(
|
10
|
-
LHC::Caching.new.send(:to_cache,
|
11
|
-
Typhoeus::Response.new(headers: { 'Accept' => 'application/json' })
|
12
|
-
)
|
9
|
+
LHC::Caching.new.send(:to_cache, response)
|
13
10
|
)
|
14
|
-
end.
|
11
|
+
end.not_to raise_error
|
15
12
|
end
|
16
13
|
end
|
17
|
-
end
|
14
|
+
end
|
data/spec/dummy/bin/rails
CHANGED
data/spec/dummy/config.ru
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe LHC::Monitoring do
|
4
|
-
|
5
4
|
let(:stub) { stub_request(:get, 'http://local.ch').to_return(status: 200, body: 'The Website') }
|
6
5
|
let(:endpoint_configuration) { LHC.config.endpoint(:local, 'http://local.ch') }
|
7
6
|
|
8
7
|
module Statsd
|
9
|
-
def self.count(
|
8
|
+
def self.count(_path, _value)
|
10
9
|
end
|
11
|
-
|
10
|
+
|
11
|
+
def self.timing(_path, _value)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -25,7 +25,6 @@ describe LHC::Monitoring do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'statsd configured' do
|
28
|
-
|
29
28
|
it 'reports trial, response and timing by default ' do
|
30
29
|
stub
|
31
30
|
expect(Statsd).to receive(:count).with('lhc.dummy.test.local_ch.get.count', 1)
|
@@ -39,7 +38,7 @@ describe LHC::Monitoring do
|
|
39
38
|
expect(Statsd).to receive(:count).with('lhc.dummy.test.local_ch.get.count', 1)
|
40
39
|
expect(Statsd).to receive(:count).with('lhc.dummy.test.local_ch.get.500', 1)
|
41
40
|
expect(Statsd).not_to receive(:timing)
|
42
|
-
expect{ LHC.get(:local) }.to raise_error LHC::ServerError
|
41
|
+
expect { LHC.get(:local) }.to raise_error LHC::ServerError
|
43
42
|
end
|
44
43
|
|
45
44
|
it 'reports timeout instead of status code if response timed out' do
|
@@ -47,7 +46,7 @@ describe LHC::Monitoring do
|
|
47
46
|
expect(Statsd).to receive(:count).with('lhc.dummy.test.local_ch.get.count', 1)
|
48
47
|
expect(Statsd).to receive(:count).with('lhc.dummy.test.local_ch.get.timeout', 1)
|
49
48
|
expect(Statsd).not_to receive(:timing)
|
50
|
-
expect{ LHC.get(:local) }.to raise_error LHC::Timeout
|
49
|
+
expect { LHC.get(:local) }.to raise_error LHC::Timeout
|
51
50
|
end
|
52
51
|
|
53
52
|
it 'allows to set the stats key for request' do
|
@@ -60,7 +59,6 @@ describe LHC::Monitoring do
|
|
60
59
|
end
|
61
60
|
|
62
61
|
context 'without protocol' do
|
63
|
-
|
64
62
|
let(:endpoint_configuration) { LHC.config.endpoint(:local, 'local.ch') }
|
65
63
|
|
66
64
|
it 'reports trial, response and timing by default ' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhc-core-interceptors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- local.ch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lhc
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: ciderizer
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: A set of useful interceptors to use with LHC (like caching, monitoring
|
112
126
|
etc.)
|
113
127
|
email:
|
@@ -117,18 +131,27 @@ extensions: []
|
|
117
131
|
extra_rdoc_files: []
|
118
132
|
files:
|
119
133
|
- ".gitignore"
|
134
|
+
- ".rubocop.localch.yml"
|
135
|
+
- ".rubocop.yml"
|
120
136
|
- Gemfile
|
121
137
|
- README.md
|
122
138
|
- Rakefile
|
123
139
|
- cider-ci.yml
|
124
|
-
- cider-ci/
|
125
|
-
- cider-ci/jobs/
|
140
|
+
- cider-ci/jobs/rspec.yml
|
141
|
+
- cider-ci/jobs/rubocop.yml
|
142
|
+
- cider-ci/scripts/bundle.yml
|
143
|
+
- cider-ci/scripts/github_comment.yml
|
144
|
+
- cider-ci/scripts/rspec.yml
|
145
|
+
- cider-ci/scripts/rubocop.yml
|
146
|
+
- cider-ci/scripts/ruby-version.yml
|
147
|
+
- cider-ci/scripts/tmp-cache.yml
|
126
148
|
- lhc-core-interceptors.gemspec
|
127
149
|
- lib/lhc-core-interceptors.rb
|
128
150
|
- lib/lhc-core-interceptors/auth.rb
|
129
151
|
- lib/lhc-core-interceptors/caching.rb
|
130
152
|
- lib/lhc-core-interceptors/monitoring.rb
|
131
153
|
- lib/lhc-core-interceptors/version.rb
|
154
|
+
- spec/auth/basic_auth_spec.rb
|
132
155
|
- spec/auth/bearer_spec.rb
|
133
156
|
- spec/caching/main_spec.rb
|
134
157
|
- spec/caching/parameters_spec.rb
|
@@ -203,6 +226,7 @@ signing_key:
|
|
203
226
|
specification_version: 4
|
204
227
|
summary: A set of interceptors
|
205
228
|
test_files:
|
229
|
+
- spec/auth/basic_auth_spec.rb
|
206
230
|
- spec/auth/bearer_spec.rb
|
207
231
|
- spec/caching/main_spec.rb
|
208
232
|
- spec/caching/parameters_spec.rb
|
data/cider-ci/contexts/rspec.yml
DELETED
data/cider-ci/jobs/tests.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
tests:
|
2
|
-
|
3
|
-
name: 'Tests'
|
4
|
-
|
5
|
-
run-on:
|
6
|
-
- type: branch
|
7
|
-
include-match: ^.*$
|
8
|
-
|
9
|
-
context:
|
10
|
-
|
11
|
-
_cider-ci_include:
|
12
|
-
- cider-ci/contexts/rspec.yml
|
13
|
-
|
14
|
-
task-defaults:
|
15
|
-
|
16
|
-
scripts:
|
17
|
-
|
18
|
-
bundle:
|
19
|
-
body: sed 's/^source.*/source "http\:\/\/52.29.7.59:9292"/g' Gemfile > Gemfile.tmp ; mv Gemfile.tmp Gemfile && bundle install
|
20
|
-
|
21
|
-
ruby-version:
|
22
|
-
body: ruby --version
|
23
|
-
|
24
|
-
test:
|
25
|
-
start-when:
|
26
|
-
- script: bundle
|
27
|
-
- script: ruby-version
|