webmock 3.18.1 → 3.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +34 -15
  4. data/lib/webmock/api.rb +2 -0
  5. data/lib/webmock/assertion_failure.rb +2 -0
  6. data/lib/webmock/callback_registry.rb +2 -0
  7. data/lib/webmock/config.rb +2 -0
  8. data/lib/webmock/cucumber.rb +2 -0
  9. data/lib/webmock/deprecation.rb +2 -0
  10. data/lib/webmock/errors.rb +2 -0
  11. data/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +2 -0
  12. data/lib/webmock/http_lib_adapters/curb_adapter.rb +2 -0
  13. data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +14 -6
  14. data/lib/webmock/http_lib_adapters/excon_adapter.rb +2 -0
  15. data/lib/webmock/http_lib_adapters/http_lib_adapter.rb +2 -0
  16. data/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +2 -0
  17. data/lib/webmock/http_lib_adapters/http_rb/client.rb +2 -0
  18. data/lib/webmock/http_lib_adapters/http_rb/request.rb +3 -1
  19. data/lib/webmock/http_lib_adapters/http_rb/response.rb +2 -0
  20. data/lib/webmock/http_lib_adapters/http_rb/streamer.rb +2 -0
  21. data/lib/webmock/http_lib_adapters/http_rb/webmock.rb +2 -0
  22. data/lib/webmock/http_lib_adapters/http_rb_adapter.rb +2 -0
  23. data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +2 -0
  24. data/lib/webmock/http_lib_adapters/manticore_adapter.rb +2 -0
  25. data/lib/webmock/http_lib_adapters/net_http.rb +2 -0
  26. data/lib/webmock/http_lib_adapters/net_http_response.rb +2 -0
  27. data/lib/webmock/http_lib_adapters/patron_adapter.rb +2 -0
  28. data/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +2 -0
  29. data/lib/webmock/matchers/any_arg_matcher.rb +2 -0
  30. data/lib/webmock/matchers/hash_argument_matcher.rb +2 -0
  31. data/lib/webmock/matchers/hash_excluding_matcher.rb +2 -0
  32. data/lib/webmock/matchers/hash_including_matcher.rb +2 -0
  33. data/lib/webmock/minitest.rb +2 -0
  34. data/lib/webmock/rack_response.rb +2 -0
  35. data/lib/webmock/request_body_diff.rb +2 -0
  36. data/lib/webmock/request_execution_verifier.rb +2 -0
  37. data/lib/webmock/request_pattern.rb +3 -1
  38. data/lib/webmock/request_registry.rb +2 -0
  39. data/lib/webmock/request_signature.rb +2 -0
  40. data/lib/webmock/request_signature_snippet.rb +2 -0
  41. data/lib/webmock/request_stub.rb +7 -1
  42. data/lib/webmock/response.rb +2 -0
  43. data/lib/webmock/responses_sequence.rb +2 -0
  44. data/lib/webmock/rspec/matchers/request_pattern_matcher.rb +2 -0
  45. data/lib/webmock/rspec/matchers/webmock_matcher.rb +2 -0
  46. data/lib/webmock/rspec/matchers.rb +2 -0
  47. data/lib/webmock/rspec.rb +2 -0
  48. data/lib/webmock/stub_registry.rb +2 -0
  49. data/lib/webmock/stub_request_snippet.rb +2 -0
  50. data/lib/webmock/test_unit.rb +2 -0
  51. data/lib/webmock/util/hash_counter.rb +12 -6
  52. data/lib/webmock/util/hash_keys_stringifier.rb +2 -0
  53. data/lib/webmock/util/hash_validator.rb +2 -0
  54. data/lib/webmock/util/headers.rb +22 -8
  55. data/lib/webmock/util/json.rb +2 -0
  56. data/lib/webmock/util/query_mapper.rb +2 -0
  57. data/lib/webmock/util/uri.rb +3 -1
  58. data/lib/webmock/util/values_stringifier.rb +2 -0
  59. data/lib/webmock/util/version_checker.rb +7 -5
  60. data/lib/webmock/version.rb +3 -1
  61. data/lib/webmock/webmock.rb +2 -0
  62. data/lib/webmock.rb +2 -0
  63. metadata +36 -168
  64. data/.gemtest +0 -0
  65. data/.github/workflows/CI.yml +0 -38
  66. data/.gitignore +0 -34
  67. data/.rspec-tm +0 -2
  68. data/Gemfile +0 -9
  69. data/Rakefile +0 -38
  70. data/minitest/test_helper.rb +0 -34
  71. data/minitest/test_webmock.rb +0 -9
  72. data/minitest/webmock_spec.rb +0 -60
  73. data/spec/acceptance/async_http_client/async_http_client_spec.rb +0 -375
  74. data/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +0 -73
  75. data/spec/acceptance/curb/curb_spec.rb +0 -510
  76. data/spec/acceptance/curb/curb_spec_helper.rb +0 -147
  77. data/spec/acceptance/em_http_request/em_http_request_spec.rb +0 -462
  78. data/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +0 -77
  79. data/spec/acceptance/excon/excon_spec.rb +0 -77
  80. data/spec/acceptance/excon/excon_spec_helper.rb +0 -52
  81. data/spec/acceptance/http_rb/http_rb_spec.rb +0 -93
  82. data/spec/acceptance/http_rb/http_rb_spec_helper.rb +0 -54
  83. data/spec/acceptance/httpclient/httpclient_spec.rb +0 -217
  84. data/spec/acceptance/httpclient/httpclient_spec_helper.rb +0 -57
  85. data/spec/acceptance/manticore/manticore_spec.rb +0 -107
  86. data/spec/acceptance/manticore/manticore_spec_helper.rb +0 -35
  87. data/spec/acceptance/net_http/net_http_shared.rb +0 -190
  88. data/spec/acceptance/net_http/net_http_spec.rb +0 -395
  89. data/spec/acceptance/net_http/net_http_spec_helper.rb +0 -64
  90. data/spec/acceptance/net_http/real_net_http_spec.rb +0 -20
  91. data/spec/acceptance/patron/patron_spec.rb +0 -123
  92. data/spec/acceptance/patron/patron_spec_helper.rb +0 -54
  93. data/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +0 -313
  94. data/spec/acceptance/shared/callbacks.rb +0 -148
  95. data/spec/acceptance/shared/complex_cross_concern_behaviors.rb +0 -36
  96. data/spec/acceptance/shared/enabling_and_disabling_webmock.rb +0 -95
  97. data/spec/acceptance/shared/precedence_of_stubs.rb +0 -15
  98. data/spec/acceptance/shared/request_expectations.rb +0 -930
  99. data/spec/acceptance/shared/returning_declared_responses.rb +0 -409
  100. data/spec/acceptance/shared/stubbing_requests.rb +0 -678
  101. data/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +0 -135
  102. data/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +0 -60
  103. data/spec/acceptance/webmock_shared.rb +0 -41
  104. data/spec/fixtures/test.txt +0 -1
  105. data/spec/quality_spec.rb +0 -84
  106. data/spec/spec_helper.rb +0 -48
  107. data/spec/support/example_curl_output.txt +0 -22
  108. data/spec/support/failures.rb +0 -9
  109. data/spec/support/my_rack_app.rb +0 -53
  110. data/spec/support/network_connection.rb +0 -19
  111. data/spec/support/webmock_server.rb +0 -70
  112. data/spec/unit/api_spec.rb +0 -175
  113. data/spec/unit/errors_spec.rb +0 -129
  114. data/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +0 -17
  115. data/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +0 -12
  116. data/spec/unit/matchers/hash_excluding_matcher_spec.rb +0 -61
  117. data/spec/unit/matchers/hash_including_matcher_spec.rb +0 -87
  118. data/spec/unit/rack_response_spec.rb +0 -112
  119. data/spec/unit/request_body_diff_spec.rb +0 -90
  120. data/spec/unit/request_execution_verifier_spec.rb +0 -208
  121. data/spec/unit/request_pattern_spec.rb +0 -748
  122. data/spec/unit/request_registry_spec.rb +0 -95
  123. data/spec/unit/request_signature_snippet_spec.rb +0 -89
  124. data/spec/unit/request_signature_spec.rb +0 -175
  125. data/spec/unit/request_stub_spec.rb +0 -234
  126. data/spec/unit/response_spec.rb +0 -314
  127. data/spec/unit/stub_registry_spec.rb +0 -103
  128. data/spec/unit/stub_request_snippet_spec.rb +0 -115
  129. data/spec/unit/util/hash_counter_spec.rb +0 -39
  130. data/spec/unit/util/hash_keys_stringifier_spec.rb +0 -27
  131. data/spec/unit/util/headers_spec.rb +0 -28
  132. data/spec/unit/util/json_spec.rb +0 -33
  133. data/spec/unit/util/query_mapper_spec.rb +0 -157
  134. data/spec/unit/util/uri_spec.rb +0 -371
  135. data/spec/unit/util/version_checker_spec.rb +0 -65
  136. data/spec/unit/webmock_spec.rb +0 -114
  137. data/test/http_request.rb +0 -24
  138. data/test/shared_test.rb +0 -108
  139. data/test/test_helper.rb +0 -23
  140. data/test/test_webmock.rb +0 -12
  141. data/webmock.gemspec +0 -54
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'base64'
2
4
 
3
5
  module WebMock
@@ -6,18 +8,21 @@ module WebMock
6
8
 
7
9
  class Headers
8
10
 
11
+ STANDARD_HEADER_DELIMITER = '-'.freeze
12
+ NONSTANDARD_HEADER_DELIMITER = '_'.freeze
13
+ JOIN = ', '.freeze
14
+
9
15
  def self.normalize_headers(headers)
10
16
  return nil unless headers
11
- array = headers.map { |name, value|
12
- [name.to_s.split(/_|-/).map { |segment| segment.capitalize }.join("-"),
13
- case value
17
+
18
+ headers.each_with_object({}) do |(name, value), new_headers|
19
+ new_headers[normalize_name(name)] =
20
+ case value
14
21
  when Regexp then value
15
- when Array then (value.size == 1) ? value.first.to_s : value.map {|v| v.to_s}.sort
22
+ when Array then (value.size == 1) ? value.first.to_s : value.map(&:to_s).sort
16
23
  else value.to_s
17
- end
18
- ]
19
- }
20
- Hash[*array.inject([]) {|r,x| r + x}]
24
+ end
25
+ end
21
26
  end
22
27
 
23
28
  def self.sorted_headers_string(headers)
@@ -57,6 +62,15 @@ module WebMock
57
62
  "Basic #{Base64.strict_encode64(credentials.join(':')).chomp}"
58
63
  end
59
64
 
65
+ def self.normalize_name(name)
66
+ name
67
+ .to_s
68
+ .tr(NONSTANDARD_HEADER_DELIMITER, STANDARD_HEADER_DELIMITER)
69
+ .split(STANDARD_HEADER_DELIMITER)
70
+ .map!(&:capitalize)
71
+ .join(STANDARD_HEADER_DELIMITER)
72
+ end
73
+
60
74
  end
61
75
 
62
76
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This is a copy of https://github.com/jnunemaker/crack/blob/master/lib/crack/json.rb
2
4
  # with date parsing removed
3
5
  # Copyright (c) 2004-2008 David Heinemeier Hansson
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WebMock::Util
2
4
  class QueryMapper
3
5
  class << self
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WebMock
2
4
 
3
5
  module Util
@@ -68,7 +70,7 @@ module WebMock
68
70
 
69
71
  def self.is_uri_localhost?(uri)
70
72
  uri.is_a?(Addressable::URI) &&
71
- %w(localhost 127.0.0.1 0.0.0.0).include?(uri.host)
73
+ %w(localhost 127.0.0.1 0.0.0.0 [::1]).include?(uri.host)
72
74
  end
73
75
 
74
76
  private
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class WebMock::Util::ValuesStringifier
2
4
  def self.stringify_values(value)
3
5
  case value
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This code was created based on https://github.com/myronmarston/vcr/blob/master/lib/vcr/util/version_checker.rb
2
4
  # Thanks to @myronmarston
3
5
 
@@ -84,12 +86,12 @@ module WebMock
84
86
  def compare_version
85
87
  case
86
88
  when @major < @min_major then :too_low
89
+ when @major == @min_major && @minor < @min_minor then :too_low
90
+ when @major == @min_major && @minor == @min_minor && @patch < @min_patch then :too_low
87
91
  when @max_major && @major > @max_major then :too_high
88
- when @major > @min_major then :ok
89
- when @minor < @min_minor then :too_low
90
- when @max_minor && @minor > @max_minor then :too_high
91
- when @minor > @min_minor then :ok
92
- when @patch < @min_patch then :too_low
92
+ when @max_major && @major == @max_major && @max_minor && @minor > @max_minor then :too_high
93
+
94
+ else :ok
93
95
  end
94
96
  end
95
97
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WebMock
2
- VERSION = '3.18.1' unless defined?(::WebMock::VERSION)
4
+ VERSION = '3.19.0' unless defined?(::WebMock::VERSION)
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WebMock
2
4
 
3
5
  def self.included(clazz)
data/lib/webmock.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'singleton'
2
4
 
3
5
  require 'addressable/uri'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.1
4
+ version: 3.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Blimke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -128,6 +128,20 @@ dependencies:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: 1.0.0
131
+ - !ruby/object:Gem::Dependency
132
+ name: async-http
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 0.48.0
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 0.48.0
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: http
133
147
  requirement: !ruby/object:Gem::Requirement
@@ -198,20 +212,6 @@ dependencies:
198
212
  - - ">="
199
213
  - !ruby/object:Gem::Version
200
214
  version: 0.27.5
201
- - !ruby/object:Gem::Dependency
202
- name: async-http
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - ">="
206
- - !ruby/object:Gem::Version
207
- version: 0.48.0
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - ">="
213
- - !ruby/object:Gem::Version
214
- version: 0.48.0
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: minitest
217
217
  requirement: !ruby/object:Gem::Requirement
@@ -268,6 +268,20 @@ dependencies:
268
268
  - - ">="
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
+ - !ruby/object:Gem::Dependency
272
+ name: rspec-retry
273
+ requirement: !ruby/object:Gem::Requirement
274
+ requirements:
275
+ - - ">="
276
+ - !ruby/object:Gem::Version
277
+ version: '0'
278
+ type: :development
279
+ prerelease: false
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ requirements:
282
+ - - ">="
283
+ - !ruby/object:Gem::Version
284
+ version: '0'
271
285
  description: WebMock allows stubbing HTTP requests and setting expectations on HTTP
272
286
  requests.
273
287
  email:
@@ -276,15 +290,9 @@ executables: []
276
290
  extensions: []
277
291
  extra_rdoc_files: []
278
292
  files:
279
- - ".gemtest"
280
- - ".github/workflows/CI.yml"
281
- - ".gitignore"
282
- - ".rspec-tm"
283
293
  - CHANGELOG.md
284
- - Gemfile
285
294
  - LICENSE
286
295
  - README.md
287
- - Rakefile
288
296
  - lib/webmock.rb
289
297
  - lib/webmock/api.rb
290
298
  - lib/webmock/assertion_failure.rb
@@ -344,86 +352,14 @@ files:
344
352
  - lib/webmock/util/version_checker.rb
345
353
  - lib/webmock/version.rb
346
354
  - lib/webmock/webmock.rb
347
- - minitest/test_helper.rb
348
- - minitest/test_webmock.rb
349
- - minitest/webmock_spec.rb
350
- - spec/acceptance/async_http_client/async_http_client_spec.rb
351
- - spec/acceptance/async_http_client/async_http_client_spec_helper.rb
352
- - spec/acceptance/curb/curb_spec.rb
353
- - spec/acceptance/curb/curb_spec_helper.rb
354
- - spec/acceptance/em_http_request/em_http_request_spec.rb
355
- - spec/acceptance/em_http_request/em_http_request_spec_helper.rb
356
- - spec/acceptance/excon/excon_spec.rb
357
- - spec/acceptance/excon/excon_spec_helper.rb
358
- - spec/acceptance/http_rb/http_rb_spec.rb
359
- - spec/acceptance/http_rb/http_rb_spec_helper.rb
360
- - spec/acceptance/httpclient/httpclient_spec.rb
361
- - spec/acceptance/httpclient/httpclient_spec_helper.rb
362
- - spec/acceptance/manticore/manticore_spec.rb
363
- - spec/acceptance/manticore/manticore_spec_helper.rb
364
- - spec/acceptance/net_http/net_http_shared.rb
365
- - spec/acceptance/net_http/net_http_spec.rb
366
- - spec/acceptance/net_http/net_http_spec_helper.rb
367
- - spec/acceptance/net_http/real_net_http_spec.rb
368
- - spec/acceptance/patron/patron_spec.rb
369
- - spec/acceptance/patron/patron_spec_helper.rb
370
- - spec/acceptance/shared/allowing_and_disabling_net_connect.rb
371
- - spec/acceptance/shared/callbacks.rb
372
- - spec/acceptance/shared/complex_cross_concern_behaviors.rb
373
- - spec/acceptance/shared/enabling_and_disabling_webmock.rb
374
- - spec/acceptance/shared/precedence_of_stubs.rb
375
- - spec/acceptance/shared/request_expectations.rb
376
- - spec/acceptance/shared/returning_declared_responses.rb
377
- - spec/acceptance/shared/stubbing_requests.rb
378
- - spec/acceptance/typhoeus/typhoeus_hydra_spec.rb
379
- - spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
380
- - spec/acceptance/webmock_shared.rb
381
- - spec/fixtures/test.txt
382
- - spec/quality_spec.rb
383
- - spec/spec_helper.rb
384
- - spec/support/example_curl_output.txt
385
- - spec/support/failures.rb
386
- - spec/support/my_rack_app.rb
387
- - spec/support/network_connection.rb
388
- - spec/support/webmock_server.rb
389
- - spec/unit/api_spec.rb
390
- - spec/unit/errors_spec.rb
391
- - spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
392
- - spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
393
- - spec/unit/matchers/hash_excluding_matcher_spec.rb
394
- - spec/unit/matchers/hash_including_matcher_spec.rb
395
- - spec/unit/rack_response_spec.rb
396
- - spec/unit/request_body_diff_spec.rb
397
- - spec/unit/request_execution_verifier_spec.rb
398
- - spec/unit/request_pattern_spec.rb
399
- - spec/unit/request_registry_spec.rb
400
- - spec/unit/request_signature_snippet_spec.rb
401
- - spec/unit/request_signature_spec.rb
402
- - spec/unit/request_stub_spec.rb
403
- - spec/unit/response_spec.rb
404
- - spec/unit/stub_registry_spec.rb
405
- - spec/unit/stub_request_snippet_spec.rb
406
- - spec/unit/util/hash_counter_spec.rb
407
- - spec/unit/util/hash_keys_stringifier_spec.rb
408
- - spec/unit/util/headers_spec.rb
409
- - spec/unit/util/json_spec.rb
410
- - spec/unit/util/query_mapper_spec.rb
411
- - spec/unit/util/uri_spec.rb
412
- - spec/unit/util/version_checker_spec.rb
413
- - spec/unit/webmock_spec.rb
414
- - test/http_request.rb
415
- - test/shared_test.rb
416
- - test/test_helper.rb
417
- - test/test_webmock.rb
418
- - webmock.gemspec
419
355
  homepage: https://github.com/bblimke/webmock
420
356
  licenses:
421
357
  - MIT
422
358
  metadata:
423
359
  bug_tracker_uri: https://github.com/bblimke/webmock/issues
424
- changelog_uri: https://github.com/bblimke/webmock/blob/v3.18.1/CHANGELOG.md
425
- documentation_uri: https://www.rubydoc.info/gems/webmock/3.18.1
426
- source_code_uri: https://github.com/bblimke/webmock/tree/v3.18.1
360
+ changelog_uri: https://github.com/bblimke/webmock/blob/v3.19.0/CHANGELOG.md
361
+ documentation_uri: https://www.rubydoc.info/gems/webmock/3.19.0
362
+ source_code_uri: https://github.com/bblimke/webmock/tree/v3.19.0
427
363
  wiki_uri: https://github.com/bblimke/webmock/wiki
428
364
  post_install_message:
429
365
  rdoc_options: []
@@ -433,83 +369,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
433
369
  requirements:
434
370
  - - ">="
435
371
  - !ruby/object:Gem::Version
436
- version: '2.3'
372
+ version: '2.5'
437
373
  required_rubygems_version: !ruby/object:Gem::Requirement
438
374
  requirements:
439
375
  - - ">="
440
376
  - !ruby/object:Gem::Version
441
377
  version: '0'
442
378
  requirements: []
443
- rubygems_version: 3.1.2
379
+ rubygems_version: 3.4.10
444
380
  signing_key:
445
381
  specification_version: 4
446
382
  summary: Library for stubbing HTTP requests in Ruby.
447
- test_files:
448
- - spec/acceptance/async_http_client/async_http_client_spec.rb
449
- - spec/acceptance/async_http_client/async_http_client_spec_helper.rb
450
- - spec/acceptance/curb/curb_spec.rb
451
- - spec/acceptance/curb/curb_spec_helper.rb
452
- - spec/acceptance/em_http_request/em_http_request_spec.rb
453
- - spec/acceptance/em_http_request/em_http_request_spec_helper.rb
454
- - spec/acceptance/excon/excon_spec.rb
455
- - spec/acceptance/excon/excon_spec_helper.rb
456
- - spec/acceptance/http_rb/http_rb_spec.rb
457
- - spec/acceptance/http_rb/http_rb_spec_helper.rb
458
- - spec/acceptance/httpclient/httpclient_spec.rb
459
- - spec/acceptance/httpclient/httpclient_spec_helper.rb
460
- - spec/acceptance/manticore/manticore_spec.rb
461
- - spec/acceptance/manticore/manticore_spec_helper.rb
462
- - spec/acceptance/net_http/net_http_shared.rb
463
- - spec/acceptance/net_http/net_http_spec.rb
464
- - spec/acceptance/net_http/net_http_spec_helper.rb
465
- - spec/acceptance/net_http/real_net_http_spec.rb
466
- - spec/acceptance/patron/patron_spec.rb
467
- - spec/acceptance/patron/patron_spec_helper.rb
468
- - spec/acceptance/shared/allowing_and_disabling_net_connect.rb
469
- - spec/acceptance/shared/callbacks.rb
470
- - spec/acceptance/shared/complex_cross_concern_behaviors.rb
471
- - spec/acceptance/shared/enabling_and_disabling_webmock.rb
472
- - spec/acceptance/shared/precedence_of_stubs.rb
473
- - spec/acceptance/shared/request_expectations.rb
474
- - spec/acceptance/shared/returning_declared_responses.rb
475
- - spec/acceptance/shared/stubbing_requests.rb
476
- - spec/acceptance/typhoeus/typhoeus_hydra_spec.rb
477
- - spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb
478
- - spec/acceptance/webmock_shared.rb
479
- - spec/fixtures/test.txt
480
- - spec/quality_spec.rb
481
- - spec/spec_helper.rb
482
- - spec/support/example_curl_output.txt
483
- - spec/support/failures.rb
484
- - spec/support/my_rack_app.rb
485
- - spec/support/network_connection.rb
486
- - spec/support/webmock_server.rb
487
- - spec/unit/api_spec.rb
488
- - spec/unit/errors_spec.rb
489
- - spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb
490
- - spec/unit/http_lib_adapters/http_lib_adapter_spec.rb
491
- - spec/unit/matchers/hash_excluding_matcher_spec.rb
492
- - spec/unit/matchers/hash_including_matcher_spec.rb
493
- - spec/unit/rack_response_spec.rb
494
- - spec/unit/request_body_diff_spec.rb
495
- - spec/unit/request_execution_verifier_spec.rb
496
- - spec/unit/request_pattern_spec.rb
497
- - spec/unit/request_registry_spec.rb
498
- - spec/unit/request_signature_snippet_spec.rb
499
- - spec/unit/request_signature_spec.rb
500
- - spec/unit/request_stub_spec.rb
501
- - spec/unit/response_spec.rb
502
- - spec/unit/stub_registry_spec.rb
503
- - spec/unit/stub_request_snippet_spec.rb
504
- - spec/unit/util/hash_counter_spec.rb
505
- - spec/unit/util/hash_keys_stringifier_spec.rb
506
- - spec/unit/util/headers_spec.rb
507
- - spec/unit/util/json_spec.rb
508
- - spec/unit/util/query_mapper_spec.rb
509
- - spec/unit/util/uri_spec.rb
510
- - spec/unit/util/version_checker_spec.rb
511
- - spec/unit/webmock_spec.rb
512
- - test/http_request.rb
513
- - test/shared_test.rb
514
- - test/test_helper.rb
515
- - test/test_webmock.rb
383
+ test_files: []
data/.gemtest DELETED
File without changes
@@ -1,38 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- strategy:
13
- fail-fast: false
14
- matrix:
15
- ruby:
16
- - head
17
- - '3.1'
18
- - '3.0'
19
- - '2.7'
20
- - '2.6'
21
- - '2.5'
22
- - jruby
23
- continue-on-error: ${{ matrix.ruby == 'head' }}
24
- name: Ruby ${{ matrix.ruby }}
25
- env:
26
- JRUBY_OPTS: "--debug"
27
- steps:
28
- - uses: actions/checkout@v2
29
- - name: Install Apt Packages
30
- run: |
31
- sudo apt-get install libcurl4-openssl-dev -y
32
- - uses: ruby/setup-ruby@v1
33
- continue-on-error: true
34
- with:
35
- ruby-version: ${{ matrix.ruby }}
36
- bundler-cache: true
37
- - run: |
38
- bundle exec rake
data/.gitignore DELETED
@@ -1,34 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- .*.sw[a-z]
15
-
16
- ## RubyMine and related
17
- .idea
18
-
19
- ## PROJECT::GENERAL
20
- coverage
21
- rdoc
22
- pkg
23
-
24
- ## PROJECT::SPECIFIC
25
- *.gem
26
- .bundle
27
- Gemfile.lock
28
- gemfiles/*.gemfile.lock
29
- pkg/*
30
- tmp/*
31
- *.rbc
32
- *.rbx
33
- .ruby-gemset
34
- .ruby-version
data/.rspec-tm DELETED
@@ -1,2 +0,0 @@
1
- --rspec-version 2.0.0
2
- --bundler
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org/'
2
-
3
- gemspec
4
-
5
- gem 'rake'
6
-
7
- platforms :jruby do
8
- gem 'jruby-openssl'
9
- end
data/Rakefile DELETED
@@ -1,38 +0,0 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
-
4
- require "rspec/core/rake_task"
5
- RSpec::Core::RakeTask.new(:spec) do |t|
6
- t.rspec_opts = %w[
7
- --force-color
8
- --format progress
9
- --require ./spec/spec_helper.rb
10
- ]
11
- t.pattern = 'spec/**/*_spec.rb'
12
- end
13
-
14
- RSpec::Core::RakeTask.new(:spec_http_without_webmock) do |t|
15
- t.rspec_opts = %w[
16
- --force-color
17
- --format progress
18
- --require ./spec/acceptance/net_http/real_net_http_spec.rb
19
- ]
20
- t.pattern = 'spec/acceptance/net_http/real_net_http_spec.rb'
21
- end
22
-
23
- require 'rake/testtask'
24
- Rake::TestTask.new(:test) do |test|
25
- test.test_files = FileList["test/**/*.rb"].exclude("test/test_helper.rb")
26
- test.options = "--use-color"
27
- test.verbose = false
28
- test.warning = false
29
- end
30
-
31
- Rake::TestTask.new(:minitest) do |test|
32
- test.test_files = FileList["minitest/**/*.rb"].exclude("test/test_helper.rb")
33
- test.options = "--pride"
34
- test.verbose = false
35
- test.warning = false
36
- end
37
-
38
- task default: [:spec, :spec_http_without_webmock, :test, :minitest]
@@ -1,34 +0,0 @@
1
- require 'rubygems'
2
-
3
- $LOAD_PATH.unshift(File.dirname(__FILE__))
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
-
6
- require File.expand_path(File.dirname(__FILE__) + '/../test/http_request')
7
-
8
- gem 'minitest'
9
-
10
- require 'minitest/autorun'
11
- require 'webmock/minitest'
12
-
13
- test_class = defined?(MiniTest::Test) ? MiniTest::Test : MiniTest::Unit::TestCase
14
-
15
- test_class.class_eval do
16
-
17
- def assert_raise(*exp, &block)
18
- assert_raises(*exp, &block)
19
- end
20
-
21
- def assert_raise_with_message(e, message, &block)
22
- e = assert_raises(e, &block)
23
- if message.is_a?(Regexp)
24
- assert_match(message, e.message)
25
- else
26
- assert_equal(message, e.message)
27
- end
28
- end
29
-
30
- def assert_fail(message, &block)
31
- assert_raise_with_message(MiniTest::Assertion, message, &block)
32
- end
33
-
34
- end
@@ -1,9 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
- require File.expand_path(File.dirname(__FILE__) + '/../test/shared_test')
3
-
4
- test_class = defined?(MiniTest::Test) ? MiniTest::Test : MiniTest::Unit::TestCase
5
-
6
-
7
- class MiniTestWebMock < test_class
8
- include SharedTest
9
- end
@@ -1,60 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
-
3
- describe "Webmock" do
4
- include HttpRequestTestHelper
5
-
6
- before do
7
- @stub_http = stub_http_request(:any, "http://www.example.com")
8
- @stub_https = stub_http_request(:any, "https://www.example.com")
9
- end
10
-
11
- it "should update assertions count" do
12
- assert_equal 0, assertions
13
- http_request(:get, "http://www.example.com/")
14
-
15
- assert_requested(@stub_http)
16
- assert_equal 2, assertions
17
-
18
- assert_not_requested(:post, "http://www.example.com")
19
- assert_equal 4, assertions
20
- end
21
-
22
- it "should raise error on non stubbed request" do
23
- expect { http_request(:get, "http://www.example.net/") }.must_raise(WebMock::NetConnectNotAllowedError)
24
- end
25
-
26
- it "should verify that expected request occured" do
27
- http_request(:get, "http://www.example.com/")
28
- assert_requested(:get, "http://www.example.com", times: 1)
29
- assert_requested(:get, "http://www.example.com")
30
- end
31
-
32
- it "should verify that expected http stub occured" do
33
- http_request(:get, "http://www.example.com/")
34
- assert_requested(@stub_http, times: 1)
35
- assert_requested(@stub_http)
36
- end
37
-
38
- it "should verify that expected https stub occured" do
39
- http_request(:get, "https://www.example.com/")
40
- http_request(:get, "https://www.example.com/")
41
- assert_requested(@stub_https, times: 2)
42
- end
43
-
44
- it "should verify that expect request didn't occur" do
45
- expected_message = "The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times"
46
- expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
47
- assert_fail(expected_message) do
48
- assert_requested(:get, "http://www.example.com")
49
- end
50
- end
51
-
52
- it "should verify that expect stub didn't occur" do
53
- expected_message = "The request ANY http://www.example.com/ was expected to execute 1 time but it executed 0 times"
54
- expected_message += "\n\nThe following requests were made:\n\nNo requests were made.\n============================================================"
55
- assert_fail(expected_message) do
56
- assert_requested(@stub_http)
57
- end
58
- end
59
- end
60
-