http_stub 0.22.4 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http_stub.rb +15 -5
- data/lib/http_stub/configurer/dsl/request_attribute_referencer.rb +19 -0
- data/lib/http_stub/configurer/dsl/request_referencer.rb +24 -0
- data/lib/http_stub/configurer/dsl/scenario_activator.rb +2 -2
- data/lib/http_stub/configurer/dsl/scenario_builder.rb +2 -2
- data/lib/http_stub/configurer/dsl/server.rb +4 -4
- data/lib/http_stub/configurer/dsl/stub_builder.rb +5 -3
- data/lib/http_stub/configurer/request/controllable_value.rb +1 -3
- data/lib/http_stub/configurer/request/http/factory.rb +2 -2
- data/lib/http_stub/configurer/request/omittable.rb +2 -4
- data/lib/http_stub/configurer/request/regexpable.rb +3 -8
- data/lib/http_stub/configurer/server/command_processor.rb +5 -7
- data/lib/http_stub/configurer/server/facade.rb +2 -4
- data/lib/http_stub/extensions/core/hash.rb +4 -11
- data/lib/http_stub/extensions/core/hash/formatted.rb +23 -0
- data/lib/http_stub/extensions/core/hash/indifferent_and_insensitive_access.rb +24 -0
- data/lib/http_stub/extensions/core/hash/with_indifferent_and_insensitive_access.rb +18 -0
- data/lib/http_stub/extensions/rack/handler.rb +1 -1
- data/lib/http_stub/rake/task_generators.rb +1 -1
- data/lib/http_stub/server/application.rb +10 -11
- data/lib/http_stub/server/application_helpers.rb +3 -5
- data/lib/http_stub/server/daemon.rb +5 -6
- data/lib/http_stub/server/request.rb +3 -10
- data/lib/http_stub/server/request/headers.rb +25 -0
- data/lib/http_stub/server/request/parameters.rb +21 -0
- data/lib/http_stub/server/request/request.rb +21 -0
- data/lib/http_stub/server/scenario/links.rb +1 -1
- data/lib/http_stub/server/stub/controller.rb +1 -1
- data/lib/http_stub/server/stub/empty.rb +4 -0
- data/lib/http_stub/server/stub/match/hash_matcher.rb +19 -0
- data/lib/http_stub/server/stub/match/omitted_value_matcher.rb +1 -3
- data/lib/http_stub/server/stub/match/rule/body.rb +2 -4
- data/lib/http_stub/server/stub/match/rule/headers.rb +5 -11
- data/lib/http_stub/server/stub/match/rule/json_body.rb +3 -5
- data/lib/http_stub/server/stub/match/rule/method.rb +1 -1
- data/lib/http_stub/server/stub/match/rule/parameters.rb +4 -7
- data/lib/http_stub/server/stub/match/rule/simple_body.rb +3 -3
- data/lib/http_stub/server/stub/match/rule/truthy.rb +27 -0
- data/lib/http_stub/server/stub/match/rule/uri.rb +3 -3
- data/lib/http_stub/server/stub/match/string_value_matcher.rb +4 -13
- data/lib/http_stub/server/stub/response.rb +5 -2
- data/lib/http_stub/server/stub/response/attribute/body.rb +32 -0
- data/lib/http_stub/server/stub/response/attribute/headers.rb +26 -0
- data/lib/http_stub/server/stub/response/attribute/interpolator.rb +26 -0
- data/lib/http_stub/server/stub/response/attribute/interpolator/headers.rb +27 -0
- data/lib/http_stub/server/stub/response/attribute/interpolator/parameters.rb +27 -0
- data/lib/http_stub/server/stub/response/base.rb +5 -16
- data/lib/http_stub/server/stub/response/file.rb +6 -2
- data/lib/http_stub/server/stub/response/text.rb +12 -0
- data/lib/http_stub/server/stub/stub.rb +4 -0
- data/lib/http_stub/version.rb +1 -1
- data/spec/acceptance/request_reference_spec.rb +44 -0
- data/spec/lib/http_stub/configurer/dsl/request_attribute_referencer_spec.rb +37 -0
- data/spec/lib/http_stub/configurer/dsl/request_referencer_spec.rb +37 -0
- data/spec/lib/http_stub/configurer/dsl/scenario_activator_spec.rb +14 -14
- data/spec/lib/http_stub/configurer/dsl/server_spec.rb +2 -6
- data/spec/lib/http_stub/configurer/dsl/stub_builder_spec.rb +34 -8
- data/spec/lib/http_stub/{server/formatted_hash_spec.rb → extensions/core/hash/formatted_spec.rb} +4 -6
- data/spec/lib/http_stub/{hash_with_indifferent_and_insensitive_access_spec.rb → extensions/core/hash/indifferent_and_insensitive_access_spec.rb} +8 -4
- data/spec/lib/http_stub/extensions/core/hash/with_indifferent_and_insensitive_access_spec.rb +41 -0
- data/spec/lib/http_stub/extensions/core/hash_spec.rb +11 -129
- data/spec/lib/http_stub/server/application_spec.rb +1 -1
- data/spec/lib/http_stub/server/payload_file_consolidator_spec.rb +1 -1
- data/spec/lib/http_stub/server/request/headers_spec.rb +89 -0
- data/spec/lib/http_stub/server/request/parameters_spec.rb +60 -0
- data/spec/lib/http_stub/server/request/request_spec.rb +84 -0
- data/spec/lib/http_stub/server/request_spec.rb +9 -98
- data/spec/lib/http_stub/server/response_spec.rb +2 -6
- data/spec/lib/http_stub/server/scenario/controller_spec.rb +1 -1
- data/spec/lib/http_stub/server/scenario/parser_spec.rb +3 -1
- data/spec/lib/http_stub/server/stub/controller_spec.rb +11 -4
- data/spec/lib/http_stub/server/stub/empty_spec.rb +10 -0
- data/spec/lib/http_stub/server/stub/match/hash_matcher_spec.rb +122 -0
- data/spec/lib/http_stub/server/stub/match/rule/body_spec.rb +4 -4
- data/spec/lib/http_stub/server/stub/match/rule/headers_spec.rb +54 -45
- data/spec/lib/http_stub/server/stub/match/rule/json_body_spec.rb +5 -5
- data/spec/lib/http_stub/server/stub/match/rule/method_spec.rb +19 -17
- data/spec/lib/http_stub/server/stub/match/rule/parameters_spec.rb +26 -33
- data/spec/lib/http_stub/server/stub/match/rule/simple_body_spec.rb +16 -25
- data/spec/lib/http_stub/server/stub/match/{truthy_matcher_spec.rb → rule/truthy_spec.rb} +3 -5
- data/spec/lib/http_stub/server/stub/match/rule/uri_spec.rb +16 -25
- data/spec/lib/http_stub/server/stub/match/string_value_matcher_spec.rb +2 -12
- data/spec/lib/http_stub/server/stub/parser_spec.rb +5 -3
- data/spec/lib/http_stub/server/stub/response/attribute/body_spec.rb +98 -0
- data/spec/lib/http_stub/server/stub/response/attribute/headers_spec.rb +57 -0
- data/spec/lib/http_stub/server/stub/response/attribute/interpolator/headers_spec.rb +53 -0
- data/spec/lib/http_stub/server/stub/response/attribute/interpolator/parameters_spec.rb +53 -0
- data/spec/lib/http_stub/server/stub/response/attribute/interpolator_spec.rb +41 -0
- data/spec/lib/http_stub/server/stub/response/base_spec.rb +6 -53
- data/spec/lib/http_stub/server/stub/response/file_spec.rb +48 -7
- data/spec/lib/http_stub/server/stub/response/text_spec.rb +66 -1
- data/spec/lib/http_stub/server/stub/stub_spec.rb +25 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/support/http_stub/server/request_fixture.rb +1 -1
- metadata +86 -26
- data/lib/http_stub/hash_with_indifferent_and_insensitive_access.rb +0 -18
- data/lib/http_stub/server/formatted_hash.rb +0 -18
- data/lib/http_stub/server/header_parser.rb +0 -17
- data/lib/http_stub/server/stub/match/hash_with_string_value_matchers.rb +0 -26
- data/lib/http_stub/server/stub/match/truthy_matcher.rb +0 -25
- data/spec/lib/http_stub/server/header_parser_spec.rb +0 -51
- data/spec/lib/http_stub/server/stub/match/hash_with_string_value_matchers_spec.rb +0 -166
@@ -49,7 +49,8 @@ describe HttpStub::Server::Stub::Stub do
|
|
49
49
|
let(:request_headers) { instance_double(HttpStub::Server::Stub::Match::Rule::Headers, matches?: true) }
|
50
50
|
let(:request_parameters) { instance_double(HttpStub::Server::Stub::Match::Rule::Parameters, matches?: true) }
|
51
51
|
let(:request_body) { double("HttpStub::Server::Stub::SomeRequestBody", matches?: true) }
|
52
|
-
let(:
|
52
|
+
let(:response_types) { [ HttpStub::Server::Stub::Response::Text, HttpStub::Server::Stub::Response::File ] }
|
53
|
+
let(:response) { instance_double(response_types.sample) }
|
53
54
|
let(:triggers) { instance_double(HttpStub::Server::Stub::Triggers) }
|
54
55
|
|
55
56
|
let(:the_stub) { HttpStub::Server::Stub::Stub.new(stub_payload) }
|
@@ -66,13 +67,12 @@ describe HttpStub::Server::Stub::Stub do
|
|
66
67
|
|
67
68
|
describe "#matches?" do
|
68
69
|
|
69
|
-
let(:logger)
|
70
|
+
let(:logger) { instance_double(Logger) }
|
70
71
|
|
71
72
|
context "when a request is provided" do
|
72
73
|
|
73
74
|
let(:request_method) { request_method_payload }
|
74
|
-
let(:
|
75
|
-
let(:request) { instance_double(HttpStub::Server::Request, method: request_method_payload) }
|
75
|
+
let(:request) { instance_double(HttpStub::Server::Request::Request, method: request_method_payload) }
|
76
76
|
|
77
77
|
subject { the_stub.matches?(request, logger) }
|
78
78
|
|
@@ -205,6 +205,27 @@ describe HttpStub::Server::Stub::Stub do
|
|
205
205
|
|
206
206
|
end
|
207
207
|
|
208
|
+
describe "#repsonse_for" do
|
209
|
+
|
210
|
+
let(:request) { instance_double(HttpStub::Server::Request::Request) }
|
211
|
+
|
212
|
+
subject { the_stub.response_for(request) }
|
213
|
+
|
214
|
+
it "replaces values in the response with those from the request" do
|
215
|
+
expect(response).to receive(:with_values_from).with(request)
|
216
|
+
|
217
|
+
subject
|
218
|
+
end
|
219
|
+
|
220
|
+
it "returns the response with replaced values" do
|
221
|
+
response_with_replaced_values = instance_double(response_types.sample)
|
222
|
+
allow(response).to receive(:with_values_from).and_return(response_with_replaced_values)
|
223
|
+
|
224
|
+
expect(subject).to eql(response_with_replaced_values)
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
228
|
+
|
208
229
|
describe "#uri" do
|
209
230
|
|
210
231
|
it "returns the uri model encapsulating the uri provided in the request body" do
|
data/spec/spec_helper.rb
CHANGED
@@ -29,6 +29,7 @@ require_relative '../examples/configurer_with_file_responses'
|
|
29
29
|
require_relative '../examples/configurer_with_stub_request_body'
|
30
30
|
require_relative '../examples/configurer_with_parts'
|
31
31
|
require_relative '../examples/configurer_with_endpoint_template'
|
32
|
+
require_relative '../examples/configurer_with_request_references'
|
32
33
|
require_relative '../examples/authentication_service/configurer'
|
33
34
|
|
34
35
|
HttpStub::Server::Daemon.log_dir = ::File.expand_path('../../tmp/log', __FILE__)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_stub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dueckes
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-05-
|
15
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -140,6 +140,20 @@ dependencies:
|
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '3.4'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: rubocop
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0.40'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0.40'
|
143
157
|
- !ruby/object:Gem::Dependency
|
144
158
|
name: rspec
|
145
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,19 +169,19 @@ dependencies:
|
|
155
169
|
- !ruby/object:Gem::Version
|
156
170
|
version: '3.4'
|
157
171
|
- !ruby/object:Gem::Dependency
|
158
|
-
name:
|
172
|
+
name: coderay
|
159
173
|
requirement: !ruby/object:Gem::Requirement
|
160
174
|
requirements:
|
161
175
|
- - "~>"
|
162
176
|
- !ruby/object:Gem::Version
|
163
|
-
version: '
|
177
|
+
version: '1.1'
|
164
178
|
type: :development
|
165
179
|
prerelease: false
|
166
180
|
version_requirements: !ruby/object:Gem::Requirement
|
167
181
|
requirements:
|
168
182
|
- - "~>"
|
169
183
|
- !ruby/object:Gem::Version
|
170
|
-
version: '
|
184
|
+
version: '1.1'
|
171
185
|
- !ruby/object:Gem::Dependency
|
172
186
|
name: rack-test
|
173
187
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,33 +211,33 @@ dependencies:
|
|
197
211
|
- !ruby/object:Gem::Version
|
198
212
|
version: '1.8'
|
199
213
|
- !ruby/object:Gem::Dependency
|
200
|
-
name:
|
214
|
+
name: httparty
|
201
215
|
requirement: !ruby/object:Gem::Requirement
|
202
216
|
requirements:
|
203
217
|
- - "~>"
|
204
218
|
- !ruby/object:Gem::Version
|
205
|
-
version: '
|
219
|
+
version: '0.13'
|
206
220
|
type: :development
|
207
221
|
prerelease: false
|
208
222
|
version_requirements: !ruby/object:Gem::Requirement
|
209
223
|
requirements:
|
210
224
|
- - "~>"
|
211
225
|
- !ruby/object:Gem::Version
|
212
|
-
version: '
|
226
|
+
version: '0.13'
|
213
227
|
- !ruby/object:Gem::Dependency
|
214
|
-
name:
|
228
|
+
name: nokogiri
|
215
229
|
requirement: !ruby/object:Gem::Requirement
|
216
230
|
requirements:
|
217
231
|
- - "~>"
|
218
232
|
- !ruby/object:Gem::Version
|
219
|
-
version: '
|
233
|
+
version: '1.6'
|
220
234
|
type: :development
|
221
235
|
prerelease: false
|
222
236
|
version_requirements: !ruby/object:Gem::Requirement
|
223
237
|
requirements:
|
224
238
|
- - "~>"
|
225
239
|
- !ruby/object:Gem::Version
|
226
|
-
version: '
|
240
|
+
version: '1.6'
|
227
241
|
- !ruby/object:Gem::Dependency
|
228
242
|
name: wait_until
|
229
243
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,6 +252,20 @@ dependencies:
|
|
238
252
|
- - "~>"
|
239
253
|
- !ruby/object:Gem::Version
|
240
254
|
version: '0.3'
|
255
|
+
- !ruby/object:Gem::Dependency
|
256
|
+
name: simplecov
|
257
|
+
requirement: !ruby/object:Gem::Requirement
|
258
|
+
requirements:
|
259
|
+
- - "~>"
|
260
|
+
- !ruby/object:Gem::Version
|
261
|
+
version: '0.11'
|
262
|
+
type: :development
|
263
|
+
prerelease: false
|
264
|
+
version_requirements: !ruby/object:Gem::Requirement
|
265
|
+
requirements:
|
266
|
+
- - "~>"
|
267
|
+
- !ruby/object:Gem::Version
|
268
|
+
version: '0.11'
|
241
269
|
- !ruby/object:Gem::Dependency
|
242
270
|
name: travis-lint
|
243
271
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,6 +304,8 @@ files:
|
|
276
304
|
- "./lib/http_stub/configurer.rb"
|
277
305
|
- "./lib/http_stub/configurer/dsl/deprecated.rb"
|
278
306
|
- "./lib/http_stub/configurer/dsl/endpoint_template.rb"
|
307
|
+
- "./lib/http_stub/configurer/dsl/request_attribute_referencer.rb"
|
308
|
+
- "./lib/http_stub/configurer/dsl/request_referencer.rb"
|
279
309
|
- "./lib/http_stub/configurer/dsl/scenario_activator.rb"
|
280
310
|
- "./lib/http_stub/configurer/dsl/scenario_builder.rb"
|
281
311
|
- "./lib/http_stub/configurer/dsl/server.rb"
|
@@ -299,20 +329,23 @@ files:
|
|
299
329
|
- "./lib/http_stub/configurer/server/facade.rb"
|
300
330
|
- "./lib/http_stub/configurer/server/request_processor.rb"
|
301
331
|
- "./lib/http_stub/extensions/core/hash.rb"
|
332
|
+
- "./lib/http_stub/extensions/core/hash/formatted.rb"
|
333
|
+
- "./lib/http_stub/extensions/core/hash/indifferent_and_insensitive_access.rb"
|
334
|
+
- "./lib/http_stub/extensions/core/hash/with_indifferent_and_insensitive_access.rb"
|
302
335
|
- "./lib/http_stub/extensions/rack/handler.rb"
|
303
|
-
- "./lib/http_stub/hash_with_indifferent_and_insensitive_access.rb"
|
304
336
|
- "./lib/http_stub/rake/server_daemon_tasks.rb"
|
305
337
|
- "./lib/http_stub/rake/server_tasks.rb"
|
306
338
|
- "./lib/http_stub/rake/task_generators.rb"
|
307
339
|
- "./lib/http_stub/server/application.rb"
|
308
340
|
- "./lib/http_stub/server/application_helpers.rb"
|
309
341
|
- "./lib/http_stub/server/daemon.rb"
|
310
|
-
- "./lib/http_stub/server/formatted_hash.rb"
|
311
|
-
- "./lib/http_stub/server/header_parser.rb"
|
312
342
|
- "./lib/http_stub/server/public/favicon.ico"
|
313
343
|
- "./lib/http_stub/server/public/jquery-2.2.1.min.js"
|
314
344
|
- "./lib/http_stub/server/registry.rb"
|
315
345
|
- "./lib/http_stub/server/request.rb"
|
346
|
+
- "./lib/http_stub/server/request/headers.rb"
|
347
|
+
- "./lib/http_stub/server/request/parameters.rb"
|
348
|
+
- "./lib/http_stub/server/request/request.rb"
|
316
349
|
- "./lib/http_stub/server/response.rb"
|
317
350
|
- "./lib/http_stub/server/response_pipeline.rb"
|
318
351
|
- "./lib/http_stub/server/scenario.rb"
|
@@ -326,7 +359,7 @@ files:
|
|
326
359
|
- "./lib/http_stub/server/stub/controller.rb"
|
327
360
|
- "./lib/http_stub/server/stub/empty.rb"
|
328
361
|
- "./lib/http_stub/server/stub/match/exact_value_matcher.rb"
|
329
|
-
- "./lib/http_stub/server/stub/match/
|
362
|
+
- "./lib/http_stub/server/stub/match/hash_matcher.rb"
|
330
363
|
- "./lib/http_stub/server/stub/match/omitted_value_matcher.rb"
|
331
364
|
- "./lib/http_stub/server/stub/match/regexp_value_matcher.rb"
|
332
365
|
- "./lib/http_stub/server/stub/match/result.rb"
|
@@ -336,13 +369,18 @@ files:
|
|
336
369
|
- "./lib/http_stub/server/stub/match/rule/method.rb"
|
337
370
|
- "./lib/http_stub/server/stub/match/rule/parameters.rb"
|
338
371
|
- "./lib/http_stub/server/stub/match/rule/simple_body.rb"
|
372
|
+
- "./lib/http_stub/server/stub/match/rule/truthy.rb"
|
339
373
|
- "./lib/http_stub/server/stub/match/rule/uri.rb"
|
340
374
|
- "./lib/http_stub/server/stub/match/string_value_matcher.rb"
|
341
|
-
- "./lib/http_stub/server/stub/match/truthy_matcher.rb"
|
342
375
|
- "./lib/http_stub/server/stub/parser.rb"
|
343
376
|
- "./lib/http_stub/server/stub/payload_file_consolidator.rb"
|
344
377
|
- "./lib/http_stub/server/stub/registry.rb"
|
345
378
|
- "./lib/http_stub/server/stub/response.rb"
|
379
|
+
- "./lib/http_stub/server/stub/response/attribute/body.rb"
|
380
|
+
- "./lib/http_stub/server/stub/response/attribute/headers.rb"
|
381
|
+
- "./lib/http_stub/server/stub/response/attribute/interpolator.rb"
|
382
|
+
- "./lib/http_stub/server/stub/response/attribute/interpolator/headers.rb"
|
383
|
+
- "./lib/http_stub/server/stub/response/attribute/interpolator/parameters.rb"
|
346
384
|
- "./lib/http_stub/server/stub/response/base.rb"
|
347
385
|
- "./lib/http_stub/server/stub/response/file.rb"
|
348
386
|
- "./lib/http_stub/server/stub/response/text.rb"
|
@@ -370,6 +408,7 @@ files:
|
|
370
408
|
- "./spec/acceptance/configurer_initialization_spec.rb"
|
371
409
|
- "./spec/acceptance/configurer_part_spec.rb"
|
372
410
|
- "./spec/acceptance/endpoint_template_spec.rb"
|
411
|
+
- "./spec/acceptance/request_reference_spec.rb"
|
373
412
|
- "./spec/acceptance/scenario_spec.rb"
|
374
413
|
- "./spec/acceptance/server_defaults_spec.rb"
|
375
414
|
- "./spec/acceptance/stub_body_request_matching_spec.rb"
|
@@ -380,6 +419,8 @@ files:
|
|
380
419
|
- "./spec/curl_samples.txt"
|
381
420
|
- "./spec/lib/http_stub/configurer/dsl/deprecated_spec.rb"
|
382
421
|
- "./spec/lib/http_stub/configurer/dsl/endpoint_template_spec.rb"
|
422
|
+
- "./spec/lib/http_stub/configurer/dsl/request_attribute_referencer_spec.rb"
|
423
|
+
- "./spec/lib/http_stub/configurer/dsl/request_referencer_spec.rb"
|
383
424
|
- "./spec/lib/http_stub/configurer/dsl/scenario_activator_spec.rb"
|
384
425
|
- "./spec/lib/http_stub/configurer/dsl/scenario_builder_spec.rb"
|
385
426
|
- "./spec/lib/http_stub/configurer/dsl/server_spec.rb"
|
@@ -401,9 +442,11 @@ files:
|
|
401
442
|
- "./spec/lib/http_stub/configurer/server/command_spec.rb"
|
402
443
|
- "./spec/lib/http_stub/configurer/server/facade_spec.rb"
|
403
444
|
- "./spec/lib/http_stub/configurer/server/request_processor_spec.rb"
|
445
|
+
- "./spec/lib/http_stub/extensions/core/hash/formatted_spec.rb"
|
446
|
+
- "./spec/lib/http_stub/extensions/core/hash/indifferent_and_insensitive_access_spec.rb"
|
447
|
+
- "./spec/lib/http_stub/extensions/core/hash/with_indifferent_and_insensitive_access_spec.rb"
|
404
448
|
- "./spec/lib/http_stub/extensions/core/hash_spec.rb"
|
405
449
|
- "./spec/lib/http_stub/extensions/rack/handler_spec.rb"
|
406
|
-
- "./spec/lib/http_stub/hash_with_indifferent_and_insensitive_access_spec.rb"
|
407
450
|
- "./spec/lib/http_stub/rake/server_daemon_tasks_smoke_spec.rb"
|
408
451
|
- "./spec/lib/http_stub/rake/server_tasks_smoke_spec.rb"
|
409
452
|
- "./spec/lib/http_stub/rake/server_tasks_spec.rb"
|
@@ -412,10 +455,11 @@ files:
|
|
412
455
|
- "./spec/lib/http_stub/server/application_spec.rb"
|
413
456
|
- "./spec/lib/http_stub/server/daemon_integration_spec.rb"
|
414
457
|
- "./spec/lib/http_stub/server/daemon_spec.rb"
|
415
|
-
- "./spec/lib/http_stub/server/formatted_hash_spec.rb"
|
416
|
-
- "./spec/lib/http_stub/server/header_parser_spec.rb"
|
417
458
|
- "./spec/lib/http_stub/server/payload_file_consolidator_spec.rb"
|
418
459
|
- "./spec/lib/http_stub/server/registry_spec.rb"
|
460
|
+
- "./spec/lib/http_stub/server/request/headers_spec.rb"
|
461
|
+
- "./spec/lib/http_stub/server/request/parameters_spec.rb"
|
462
|
+
- "./spec/lib/http_stub/server/request/request_spec.rb"
|
419
463
|
- "./spec/lib/http_stub/server/request_spec.rb"
|
420
464
|
- "./spec/lib/http_stub/server/response_pipeline_spec.rb"
|
421
465
|
- "./spec/lib/http_stub/server/response_spec.rb"
|
@@ -429,7 +473,7 @@ files:
|
|
429
473
|
- "./spec/lib/http_stub/server/stub/controller_spec.rb"
|
430
474
|
- "./spec/lib/http_stub/server/stub/empty_spec.rb"
|
431
475
|
- "./spec/lib/http_stub/server/stub/match/exact_value_matcher_spec.rb"
|
432
|
-
- "./spec/lib/http_stub/server/stub/match/
|
476
|
+
- "./spec/lib/http_stub/server/stub/match/hash_matcher_spec.rb"
|
433
477
|
- "./spec/lib/http_stub/server/stub/match/omitted_value_matcher_spec.rb"
|
434
478
|
- "./spec/lib/http_stub/server/stub/match/regexp_value_matcher_spec.rb"
|
435
479
|
- "./spec/lib/http_stub/server/stub/match/result_spec.rb"
|
@@ -439,12 +483,17 @@ files:
|
|
439
483
|
- "./spec/lib/http_stub/server/stub/match/rule/method_spec.rb"
|
440
484
|
- "./spec/lib/http_stub/server/stub/match/rule/parameters_spec.rb"
|
441
485
|
- "./spec/lib/http_stub/server/stub/match/rule/simple_body_spec.rb"
|
486
|
+
- "./spec/lib/http_stub/server/stub/match/rule/truthy_spec.rb"
|
442
487
|
- "./spec/lib/http_stub/server/stub/match/rule/uri_spec.rb"
|
443
488
|
- "./spec/lib/http_stub/server/stub/match/string_value_matcher_spec.rb"
|
444
|
-
- "./spec/lib/http_stub/server/stub/match/truthy_matcher_spec.rb"
|
445
489
|
- "./spec/lib/http_stub/server/stub/parser_spec.rb"
|
446
490
|
- "./spec/lib/http_stub/server/stub/registry_integration_spec.rb"
|
447
491
|
- "./spec/lib/http_stub/server/stub/registry_spec.rb"
|
492
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/body_spec.rb"
|
493
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/headers_spec.rb"
|
494
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/interpolator/headers_spec.rb"
|
495
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/interpolator/parameters_spec.rb"
|
496
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/interpolator_spec.rb"
|
448
497
|
- "./spec/lib/http_stub/server/stub/response/base_spec.rb"
|
449
498
|
- "./spec/lib/http_stub/server/stub/response/file_spec.rb"
|
450
499
|
- "./spec/lib/http_stub/server/stub/response/text_spec.rb"
|
@@ -493,6 +542,7 @@ test_files:
|
|
493
542
|
- "./spec/acceptance/configurer_initialization_spec.rb"
|
494
543
|
- "./spec/acceptance/configurer_part_spec.rb"
|
495
544
|
- "./spec/acceptance/endpoint_template_spec.rb"
|
545
|
+
- "./spec/acceptance/request_reference_spec.rb"
|
496
546
|
- "./spec/acceptance/scenario_spec.rb"
|
497
547
|
- "./spec/acceptance/server_defaults_spec.rb"
|
498
548
|
- "./spec/acceptance/stub_body_request_matching_spec.rb"
|
@@ -503,6 +553,8 @@ test_files:
|
|
503
553
|
- "./spec/curl_samples.txt"
|
504
554
|
- "./spec/lib/http_stub/configurer/dsl/deprecated_spec.rb"
|
505
555
|
- "./spec/lib/http_stub/configurer/dsl/endpoint_template_spec.rb"
|
556
|
+
- "./spec/lib/http_stub/configurer/dsl/request_attribute_referencer_spec.rb"
|
557
|
+
- "./spec/lib/http_stub/configurer/dsl/request_referencer_spec.rb"
|
506
558
|
- "./spec/lib/http_stub/configurer/dsl/scenario_activator_spec.rb"
|
507
559
|
- "./spec/lib/http_stub/configurer/dsl/scenario_builder_spec.rb"
|
508
560
|
- "./spec/lib/http_stub/configurer/dsl/server_spec.rb"
|
@@ -524,9 +576,11 @@ test_files:
|
|
524
576
|
- "./spec/lib/http_stub/configurer/server/command_spec.rb"
|
525
577
|
- "./spec/lib/http_stub/configurer/server/facade_spec.rb"
|
526
578
|
- "./spec/lib/http_stub/configurer/server/request_processor_spec.rb"
|
579
|
+
- "./spec/lib/http_stub/extensions/core/hash/formatted_spec.rb"
|
580
|
+
- "./spec/lib/http_stub/extensions/core/hash/indifferent_and_insensitive_access_spec.rb"
|
581
|
+
- "./spec/lib/http_stub/extensions/core/hash/with_indifferent_and_insensitive_access_spec.rb"
|
527
582
|
- "./spec/lib/http_stub/extensions/core/hash_spec.rb"
|
528
583
|
- "./spec/lib/http_stub/extensions/rack/handler_spec.rb"
|
529
|
-
- "./spec/lib/http_stub/hash_with_indifferent_and_insensitive_access_spec.rb"
|
530
584
|
- "./spec/lib/http_stub/rake/server_daemon_tasks_smoke_spec.rb"
|
531
585
|
- "./spec/lib/http_stub/rake/server_tasks_smoke_spec.rb"
|
532
586
|
- "./spec/lib/http_stub/rake/server_tasks_spec.rb"
|
@@ -535,10 +589,11 @@ test_files:
|
|
535
589
|
- "./spec/lib/http_stub/server/application_spec.rb"
|
536
590
|
- "./spec/lib/http_stub/server/daemon_integration_spec.rb"
|
537
591
|
- "./spec/lib/http_stub/server/daemon_spec.rb"
|
538
|
-
- "./spec/lib/http_stub/server/formatted_hash_spec.rb"
|
539
|
-
- "./spec/lib/http_stub/server/header_parser_spec.rb"
|
540
592
|
- "./spec/lib/http_stub/server/payload_file_consolidator_spec.rb"
|
541
593
|
- "./spec/lib/http_stub/server/registry_spec.rb"
|
594
|
+
- "./spec/lib/http_stub/server/request/headers_spec.rb"
|
595
|
+
- "./spec/lib/http_stub/server/request/parameters_spec.rb"
|
596
|
+
- "./spec/lib/http_stub/server/request/request_spec.rb"
|
542
597
|
- "./spec/lib/http_stub/server/request_spec.rb"
|
543
598
|
- "./spec/lib/http_stub/server/response_pipeline_spec.rb"
|
544
599
|
- "./spec/lib/http_stub/server/response_spec.rb"
|
@@ -552,7 +607,7 @@ test_files:
|
|
552
607
|
- "./spec/lib/http_stub/server/stub/controller_spec.rb"
|
553
608
|
- "./spec/lib/http_stub/server/stub/empty_spec.rb"
|
554
609
|
- "./spec/lib/http_stub/server/stub/match/exact_value_matcher_spec.rb"
|
555
|
-
- "./spec/lib/http_stub/server/stub/match/
|
610
|
+
- "./spec/lib/http_stub/server/stub/match/hash_matcher_spec.rb"
|
556
611
|
- "./spec/lib/http_stub/server/stub/match/omitted_value_matcher_spec.rb"
|
557
612
|
- "./spec/lib/http_stub/server/stub/match/regexp_value_matcher_spec.rb"
|
558
613
|
- "./spec/lib/http_stub/server/stub/match/result_spec.rb"
|
@@ -562,12 +617,17 @@ test_files:
|
|
562
617
|
- "./spec/lib/http_stub/server/stub/match/rule/method_spec.rb"
|
563
618
|
- "./spec/lib/http_stub/server/stub/match/rule/parameters_spec.rb"
|
564
619
|
- "./spec/lib/http_stub/server/stub/match/rule/simple_body_spec.rb"
|
620
|
+
- "./spec/lib/http_stub/server/stub/match/rule/truthy_spec.rb"
|
565
621
|
- "./spec/lib/http_stub/server/stub/match/rule/uri_spec.rb"
|
566
622
|
- "./spec/lib/http_stub/server/stub/match/string_value_matcher_spec.rb"
|
567
|
-
- "./spec/lib/http_stub/server/stub/match/truthy_matcher_spec.rb"
|
568
623
|
- "./spec/lib/http_stub/server/stub/parser_spec.rb"
|
569
624
|
- "./spec/lib/http_stub/server/stub/registry_integration_spec.rb"
|
570
625
|
- "./spec/lib/http_stub/server/stub/registry_spec.rb"
|
626
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/body_spec.rb"
|
627
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/headers_spec.rb"
|
628
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/interpolator/headers_spec.rb"
|
629
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/interpolator/parameters_spec.rb"
|
630
|
+
- "./spec/lib/http_stub/server/stub/response/attribute/interpolator_spec.rb"
|
571
631
|
- "./spec/lib/http_stub/server/stub/response/base_spec.rb"
|
572
632
|
- "./spec/lib/http_stub/server/stub/response/file_spec.rb"
|
573
633
|
- "./spec/lib/http_stub/server/stub/response/text_spec.rb"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
|
3
|
-
class HashWithIndifferentAndInsensitiveAccess < HashWithIndifferentAccess
|
4
|
-
|
5
|
-
def [](key)
|
6
|
-
self.key?(key) ? super : insensitive_find(key)
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def insensitive_find(key)
|
12
|
-
entry = self.find { |entry_key, _entry_value| entry_key.to_s.downcase == key.to_s.downcase }
|
13
|
-
entry ? entry[1] : nil
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class FormattedHash < Hash
|
5
|
-
|
6
|
-
def initialize(hash, key_value_delimiter)
|
7
|
-
self.merge!(hash || {})
|
8
|
-
@key_value_delimiter = key_value_delimiter
|
9
|
-
end
|
10
|
-
|
11
|
-
def to_s
|
12
|
-
self.map { |key_and_value| key_and_value.map(&:to_s).join(@key_value_delimiter) }.join(", ")
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
module Server
|
3
|
-
|
4
|
-
class HeaderParser
|
5
|
-
|
6
|
-
def self.parse(request)
|
7
|
-
request.env.reduce(HttpStub::Server::FormattedHash.new({}, ":")) do |result, element|
|
8
|
-
match = element[0].match(/^(?:HTTP_)?([A-Z0-9_]+)$/)
|
9
|
-
result[match[1]] = element[1] if match
|
10
|
-
result
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|