lhc 3.4.0 → 3.5.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 +10 -0
- data/cider-ci.yml +2 -1
- data/cider-ci/jobs/rspec.yml +48 -0
- data/cider-ci/jobs/rubocop.yml +55 -0
- data/cider-ci/scripts/bundle.yml +2 -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/lhc.gemspec +2 -1
- data/lib/lhc.rb +1 -1
- data/lib/lhc/concerns/lhc/basic_methods.rb +4 -6
- data/lib/lhc/concerns/lhc/formats.rb +0 -2
- data/lib/lhc/endpoint.rb +8 -6
- data/lib/lhc/error.rb +3 -1
- data/lib/lhc/errors/parser_error.rb +4 -0
- data/lib/lhc/formats/json.rb +18 -4
- data/lib/lhc/interceptor.rb +2 -0
- data/lib/lhc/interceptor_processor.rb +1 -1
- data/lib/lhc/request.rb +12 -10
- data/lib/lhc/response.rb +3 -9
- data/lib/lhc/version.rb +1 -1
- data/non_rails_spec/request/request_spec.rb +2 -2
- data/spec/basic_methods/delete_spec.rb +4 -6
- data/spec/basic_methods/get_spec.rb +3 -6
- data/spec/basic_methods/post_spec.rb +7 -9
- data/spec/basic_methods/put_spec.rb +7 -9
- data/spec/basic_methods/request_spec.rb +2 -4
- data/spec/config/endpoints_spec.rb +13 -16
- data/spec/config/placeholders_spec.rb +9 -11
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/initializers/cookies_serializer.rb +1 -1
- data/spec/endpoint/compile_spec.rb +3 -5
- data/spec/endpoint/match_spec.rb +10 -12
- data/spec/endpoint/placeholders_spec.rb +1 -3
- data/spec/endpoint/remove_interpolated_params_spec.rb +2 -3
- data/spec/endpoint/values_as_params_spec.rb +2 -4
- data/spec/error/find_spec.rb +37 -39
- data/spec/error/response_spec.rb +0 -2
- data/spec/error/timeout_spec.rb +1 -3
- data/spec/interceptors/after_request_spec.rb +2 -4
- data/spec/interceptors/after_response_spec.rb +3 -5
- data/spec/interceptors/before_request_spec.rb +2 -4
- data/spec/interceptors/before_response_spec.rb +2 -4
- data/spec/interceptors/default_interceptors_spec.rb +3 -5
- data/spec/interceptors/define_spec.rb +4 -6
- data/spec/interceptors/response_competition_spec.rb +6 -7
- data/spec/interceptors/return_response_spec.rb +8 -11
- data/spec/request/encoding_spec.rb +1 -4
- data/spec/request/error_handling_spec.rb +13 -2
- data/spec/request/headers_spec.rb +1 -2
- data/spec/request/option_dup_spec.rb +2 -3
- data/spec/request/parallel_requests_spec.rb +2 -2
- data/spec/request/url_patterns_spec.rb +4 -5
- data/spec/response/body_spec.rb +2 -4
- data/spec/response/code_spec.rb +2 -4
- data/spec/response/data_spec.rb +2 -4
- data/spec/response/effective_url_spec.rb +1 -3
- data/spec/response/headers_spec.rb +2 -4
- data/spec/response/options_spec.rb +2 -4
- data/spec/response/success_spec.rb +2 -3
- data/spec/response/time_spec.rb +3 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/support/reset_config.rb +0 -2
- data/spec/timeouts/no_signal_spec.rb +1 -3
- data/spec/timeouts/timings_spec.rb +27 -33
- metadata +27 -4
- data/cider-ci/contexts/rspec.yml +0 -19
- 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: b266f3f9dca6060abde6e24879a26487caec842e
|
4
|
+
data.tar.gz: 45fab92b295af92fdc2bc60488f1551471851c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d471705267c62e35f0a979c341f6a107cd7c03060698e21f72031d4d4aca57d4cbbc8c45aa1587cb01846fc18bb688acd33b893a2e7d545319717081bea113f
|
7
|
+
data.tar.gz: 6b913de77b69c93878445e073ae41363e2d0e6d31ca6baa4d7effec68b2142c20aef545426ac6798f8b62738612f1661f04239c21a0c90b762700da2b9cc13da
|
@@ -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
data/cider-ci.yml
CHANGED
@@ -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/lhc.gemspec
CHANGED
data/lib/lhc.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
|
3
3
|
module LHC
|
4
|
-
|
5
4
|
module BasicMethods
|
6
5
|
extend ActiveSupport::Concern
|
7
6
|
|
8
7
|
module ClassMethods
|
9
|
-
|
10
8
|
def request(options)
|
11
9
|
if options.is_a? Array
|
12
10
|
parallel_requests(options)
|
@@ -18,8 +16,8 @@ module LHC
|
|
18
16
|
[:get, :post, :put, :delete].each do |http_method|
|
19
17
|
define_method(http_method) do |url, options = {}|
|
20
18
|
request(options.merge(
|
21
|
-
|
22
|
-
|
19
|
+
url: url,
|
20
|
+
method: http_method
|
23
21
|
))
|
24
22
|
end
|
25
23
|
end
|
@@ -29,8 +27,8 @@ module LHC
|
|
29
27
|
def parallel_requests(options)
|
30
28
|
hydra = Typhoeus::Hydra.hydra
|
31
29
|
requests = []
|
32
|
-
options.each do |
|
33
|
-
request = LHC::Request.new(
|
30
|
+
options.each do |option|
|
31
|
+
request = LHC::Request.new(option, false)
|
34
32
|
requests << request
|
35
33
|
hydra.queue request.raw
|
36
34
|
end
|
data/lib/lhc/endpoint.rb
CHANGED
@@ -13,11 +13,12 @@ class LHC::Endpoint
|
|
13
13
|
|
14
14
|
def compile(params)
|
15
15
|
url.gsub(PLACEHOLDER) do |match|
|
16
|
-
replacement =
|
17
|
-
params.
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
replacement =
|
17
|
+
if params.is_a? Proc
|
18
|
+
params.call(match)
|
19
|
+
else
|
20
|
+
find_value(match, params)
|
21
|
+
end
|
21
22
|
replacement || fail("Compilation incomplete. Unable to find value for #{match.gsub(':', '')}.")
|
22
23
|
end
|
23
24
|
end
|
@@ -34,7 +35,8 @@ class LHC::Endpoint
|
|
34
35
|
removed = {}
|
35
36
|
url.scan(PLACEHOLDER) do |match|
|
36
37
|
match = match.gsub(/^\:/, '')
|
37
|
-
|
38
|
+
value = find_value(match, params)
|
39
|
+
if value
|
38
40
|
removed[match.to_sym] = value
|
39
41
|
params.delete(match.to_sym)
|
40
42
|
end
|