logstash-output-scalyr 0.1.10.beta → 0.1.11.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile +4 -0
  4. data/README.md +2 -2
  5. data/lib/logstash/outputs/scalyr.rb +94 -73
  6. data/lib/scalyr/common/client.rb +3 -1
  7. data/lib/scalyr/constants.rb +2 -0
  8. data/logstash-output-scalyr.gemspec +1 -1
  9. data/spec/logstash/outputs/scalyr_integration_spec.rb +119 -8
  10. data/spec/logstash/outputs/scalyr_spec.rb +9 -6
  11. data/vendor/bundle/jruby/2.5.0/cache/addressable-2.7.0.gem +0 -0
  12. data/vendor/bundle/jruby/2.5.0/cache/crack-0.4.5.gem +0 -0
  13. data/vendor/bundle/jruby/2.5.0/cache/hashdiff-1.0.1.gem +0 -0
  14. data/vendor/bundle/jruby/2.5.0/cache/public_suffix-4.0.6.gem +0 -0
  15. data/vendor/bundle/jruby/2.5.0/cache/rexml-3.2.5.gem +0 -0
  16. data/vendor/bundle/jruby/2.5.0/cache/webmock-3.13.0.gem +0 -0
  17. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/CHANGELOG.md +235 -0
  18. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Gemfile +32 -0
  19. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/LICENSE.txt +202 -0
  20. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/README.md +121 -0
  21. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Rakefile +34 -0
  22. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/data/unicode.data +0 -0
  23. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable.rb +4 -0
  24. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna.rb +27 -0
  25. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/native.rb +61 -0
  26. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/pure.rb +676 -0
  27. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/template.rb +1045 -0
  28. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb +2529 -0
  29. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/version.rb +32 -0
  30. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/idna_spec.rb +300 -0
  31. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/net_http_compat_spec.rb +30 -0
  32. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/rack_mount_compat_spec.rb +106 -0
  33. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/security_spec.rb +59 -0
  34. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/template_spec.rb +1451 -0
  35. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/uri_spec.rb +6603 -0
  36. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/spec_helper.rb +24 -0
  37. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/clobber.rake +4 -0
  38. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/gem.rake +93 -0
  39. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/git.rake +47 -0
  40. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/metrics.rake +24 -0
  41. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/rspec.rake +23 -0
  42. data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/yard.rake +29 -0
  43. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack.rb +7 -0
  44. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/json.rb +98 -0
  45. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/util.rb +17 -0
  46. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/version.rb +3 -0
  47. data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/xml.rb +238 -0
  48. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Gemfile +8 -0
  49. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/LICENSE +19 -0
  50. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/README.md +276 -0
  51. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Rakefile +18 -0
  52. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/changelog.md +100 -0
  53. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/hashdiff.gemspec +39 -0
  54. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff.rb +10 -0
  55. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/compare_hashes.rb +69 -0
  56. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/diff.rb +177 -0
  57. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs.rb +66 -0
  58. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
  59. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/linear_compare_array.rb +159 -0
  60. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/patch.rb +88 -0
  61. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/util.rb +155 -0
  62. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/version.rb +5 -0
  63. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/best_diff_spec.rb +75 -0
  64. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_array_spec.rb +60 -0
  65. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_spec.rb +360 -0
  66. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/lcs_spec.rb +76 -0
  67. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/linear_compare_array_spec.rb +50 -0
  68. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/patch_spec.rb +185 -0
  69. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/readme_spec.rb +15 -0
  70. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/util_spec.rb +116 -0
  71. data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/spec_helper.rb +15 -0
  72. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/2.0-Upgrade.md +52 -0
  73. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/CHANGELOG.md +406 -0
  74. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Gemfile +15 -0
  75. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/LICENSE.txt +22 -0
  76. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/README.md +207 -0
  77. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Rakefile +51 -0
  78. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/SECURITY.md +104 -0
  79. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/bin/console +15 -0
  80. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/codecov.yml +12 -0
  81. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/data/list.txt +13380 -0
  82. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix.rb +179 -0
  83. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/domain.rb +235 -0
  84. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/errors.rb +41 -0
  85. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/list.rb +247 -0
  86. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/rule.rb +350 -0
  87. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/version.rb +13 -0
  88. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/public_suffix.gemspec +29 -0
  89. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/acceptance_test.rb +131 -0
  90. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb +66 -0
  91. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find_all.rb +102 -0
  92. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_names.rb +91 -0
  93. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select.rb +26 -0
  94. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select_incremental.rb +25 -0
  95. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_valid.rb +101 -0
  96. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/domain_profiler.rb +12 -0
  97. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler.rb +12 -0
  98. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler_jp.rb +12 -0
  99. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/initialization_profiler.rb +11 -0
  100. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/list_profsize.rb +11 -0
  101. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/object_binsize.rb +57 -0
  102. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/psl_test.rb +52 -0
  103. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/test_helper.rb +18 -0
  104. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/tests.txt +98 -0
  105. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/domain_test.rb +106 -0
  106. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/errors_test.rb +25 -0
  107. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/list_test.rb +241 -0
  108. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/public_suffix_test.rb +188 -0
  109. data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/rule_test.rb +222 -0
  110. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
  111. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/NEWS.md +178 -0
  112. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/README.md +48 -0
  113. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/context.rdoc +143 -0
  114. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/child.rdoc +87 -0
  115. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/document.rdoc +276 -0
  116. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/element.rdoc +602 -0
  117. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/node.rdoc +97 -0
  118. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
  119. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
  120. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
  121. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
  122. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
  123. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
  124. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
  125. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
  126. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
  127. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
  128. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
  129. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
  130. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
  131. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
  132. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
  133. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
  134. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
  135. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
  136. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
  137. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
  138. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
  139. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
  140. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
  141. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
  142. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
  143. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
  144. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
  145. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
  146. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
  147. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
  148. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
  149. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
  150. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
  151. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
  152. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
  153. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
  154. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
  155. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
  156. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
  157. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
  158. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
  159. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
  160. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
  161. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
  162. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
  163. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
  164. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
  165. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
  166. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
  167. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
  168. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
  169. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
  170. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
  171. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
  172. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
  173. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
  174. data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
  175. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/CHANGELOG.md +1894 -0
  176. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Gemfile +9 -0
  177. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/LICENSE +20 -0
  178. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/README.md +1176 -0
  179. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Rakefile +38 -0
  180. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock.rb +59 -0
  181. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/api.rb +109 -0
  182. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/assertion_failure.rb +11 -0
  183. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/callback_registry.rb +35 -0
  184. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/config.rb +18 -0
  185. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/cucumber.rb +10 -0
  186. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/deprecation.rb +9 -0
  187. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/errors.rb +17 -0
  188. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
  189. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb +351 -0
  190. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +231 -0
  191. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/excon_adapter.rb +165 -0
  192. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
  193. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
  194. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
  195. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
  196. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
  197. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
  198. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
  199. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
  200. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb +259 -0
  201. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
  202. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http.rb +385 -0
  203. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
  204. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
  205. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
  206. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/any_arg_matcher.rb +13 -0
  207. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
  208. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
  209. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_including_matcher.rb +17 -0
  210. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/minitest.rb +41 -0
  211. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rack_response.rb +69 -0
  212. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_body_diff.rb +64 -0
  213. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_execution_verifier.rb +77 -0
  214. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_pattern.rb +405 -0
  215. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_registry.rb +35 -0
  216. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature.rb +54 -0
  217. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature_snippet.rb +61 -0
  218. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_stub.rb +100 -0
  219. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/response.rb +159 -0
  220. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/responses_sequence.rb +40 -0
  221. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb +42 -0
  222. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers.rb +27 -0
  223. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
  224. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/webmock_matcher.rb +67 -0
  225. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_registry.rb +82 -0
  226. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_request_snippet.rb +38 -0
  227. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/test_unit.rb +20 -0
  228. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_counter.rb +39 -0
  229. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_keys_stringifier.rb +25 -0
  230. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_validator.rb +17 -0
  231. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/headers.rb +64 -0
  232. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/json.rb +67 -0
  233. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/query_mapper.rb +281 -0
  234. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/uri.rb +111 -0
  235. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/values_stringifier.rb +20 -0
  236. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/version_checker.rb +111 -0
  237. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/version.rb +3 -0
  238. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/webmock.rb +163 -0
  239. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_helper.rb +34 -0
  240. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_webmock.rb +9 -0
  241. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/webmock_spec.rb +60 -0
  242. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
  243. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
  244. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec.rb +499 -0
  245. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec_helper.rb +147 -0
  246. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec.rb +462 -0
  247. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +77 -0
  248. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec.rb +77 -0
  249. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec_helper.rb +52 -0
  250. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
  251. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
  252. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec.rb +217 -0
  253. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
  254. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec.rb +107 -0
  255. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
  256. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_shared.rb +153 -0
  257. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec.rb +369 -0
  258. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
  259. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
  260. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec.rb +125 -0
  261. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec_helper.rb +54 -0
  262. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
  263. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/callbacks.rb +148 -0
  264. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
  265. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
  266. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
  267. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/request_expectations.rb +930 -0
  268. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/returning_declared_responses.rb +409 -0
  269. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/stubbing_requests.rb +678 -0
  270. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
  271. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
  272. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/webmock_shared.rb +41 -0
  273. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/fixtures/test.txt +1 -0
  274. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/quality_spec.rb +84 -0
  275. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/spec_helper.rb +48 -0
  276. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/example_curl_output.txt +22 -0
  277. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/failures.rb +9 -0
  278. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/my_rack_app.rb +53 -0
  279. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/network_connection.rb +19 -0
  280. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/webmock_server.rb +70 -0
  281. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/api_spec.rb +175 -0
  282. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/errors_spec.rb +129 -0
  283. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
  284. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
  285. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
  286. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
  287. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/rack_response_spec.rb +112 -0
  288. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_body_diff_spec.rb +90 -0
  289. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_execution_verifier_spec.rb +208 -0
  290. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_pattern_spec.rb +736 -0
  291. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_registry_spec.rb +95 -0
  292. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_snippet_spec.rb +89 -0
  293. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_spec.rb +155 -0
  294. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_stub_spec.rb +199 -0
  295. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/response_spec.rb +286 -0
  296. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_registry_spec.rb +103 -0
  297. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_request_snippet_spec.rb +115 -0
  298. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_counter_spec.rb +39 -0
  299. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
  300. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/headers_spec.rb +28 -0
  301. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/json_spec.rb +33 -0
  302. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/query_mapper_spec.rb +157 -0
  303. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/uri_spec.rb +371 -0
  304. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/version_checker_spec.rb +65 -0
  305. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb +60 -0
  306. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/http_request.rb +24 -0
  307. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/shared_test.rb +108 -0
  308. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_helper.rb +23 -0
  309. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_webmock.rb +12 -0
  310. data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/webmock.gemspec +54 -0
  311. data/vendor/bundle/jruby/2.5.0/specifications/addressable-2.7.0.gemspec +39 -0
  312. data/vendor/bundle/jruby/2.5.0/specifications/crack-0.4.5.gemspec +32 -0
  313. data/vendor/bundle/jruby/2.5.0/specifications/hashdiff-1.0.1.gemspec +46 -0
  314. data/vendor/bundle/jruby/2.5.0/specifications/public_suffix-4.0.6.gemspec +24 -0
  315. data/vendor/bundle/jruby/2.5.0/specifications/rexml-3.2.5.gemspec +42 -0
  316. data/vendor/bundle/jruby/2.5.0/specifications/webmock-3.13.0.gemspec +85 -0
  317. metadata +309 -2
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org/'
2
+
3
+ gemspec
4
+
5
+ gem 'rake'
6
+
7
+ platforms :jruby do
8
+ gem 'jruby-openssl'
9
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2010 Bartosz Blimke
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,1176 @@
1
+ WebMock
2
+ =======
3
+ [![Gem Version](https://badge.fury.io/rb/webmock.svg)](http://badge.fury.io/rb/webmock)
4
+ [![Build Status](https://github.com/bblimke/webmock/workflows/CI/badge.svg?branch=master)](https://github.com/bblimke/webmock/actions)
5
+ [![Code Climate](https://codeclimate.com/github/bblimke/webmock/badges/gpa.svg)](https://codeclimate.com/github/bblimke/webmock)
6
+ [![Mentioned in Awesome Ruby](https://awesome.re/mentioned-badge.svg)](https://github.com/markets/awesome-ruby)
7
+ [![Inline docs](http://inch-ci.org/github/bblimke/webmock.svg?branch=master)](http://inch-ci.org/github/bblimke/webmock)
8
+ [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=webmock&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=webmock&package-manager=bundler&version-scheme=semver)
9
+
10
+ Library for stubbing and setting expectations on HTTP requests in Ruby.
11
+
12
+ Features
13
+ --------
14
+
15
+ * Stubbing HTTP requests at low http client lib level (no need to change tests when you change HTTP library)
16
+ * Setting and verifying expectations on HTTP requests
17
+ * Matching requests based on method, URI, headers and body
18
+ * Smart matching of the same URIs in different representations (also encoded and non encoded forms)
19
+ * Smart matching of the same headers in different representations.
20
+ * Support for Test::Unit
21
+ * Support for RSpec
22
+ * Support for MiniTest
23
+
24
+ Supported HTTP libraries
25
+ ------------------------
26
+
27
+ * [Async::HTTP::Client](https://github.com/socketry/async-http)
28
+ * [Curb](https://github.com/taf2/curb) (currently only Curb::Easy)
29
+ * [EM-HTTP-Request](https://github.com/igrigorik/em-http-request)
30
+ * [Excon](https://github.com/excon/excon)
31
+ * [HTTPClient](https://github.com/nahi/httpclient)
32
+ * [HTTP Gem (also known as http.rb)](https://github.com/httprb/http)
33
+ * [httpx](https://honeyryderchuck.gitlab.io/httpx/wiki/Webmock-Adapter)
34
+ * [Manticore](https://github.com/cheald/manticore)
35
+ * [Net::HTTP](https://ruby-doc.org/stdlib-2.7.0/libdoc/net/http/rdoc/Net/HTTP.html) and other libraries based on Net::HTTP, e.g.:
36
+ * [HTTParty](https://github.com/jnunemaker/httparty)
37
+ * [REST Client](https://github.com/rest-client/rest-client)
38
+ * [Patron](https://github.com/toland/patron)
39
+ * [Typhoeus](https://github.com/typhoeus/typhoeus) (currently only Typhoeus::Hydra)
40
+
41
+ Supported Ruby Interpreters
42
+ ---------------------------
43
+
44
+ * MRI 2.5
45
+ * MRI 2.6
46
+ * MRI 2.7
47
+ * JRuby
48
+ * Rubinius
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ gem install webmock
54
+ ```
55
+ or alternatively:
56
+
57
+ ```ruby
58
+ # add to your Gemfile
59
+ group :test do
60
+ gem "webmock"
61
+ end
62
+ ```
63
+
64
+ ### or to install the latest development version from github master
65
+
66
+ git clone http://github.com/bblimke/webmock.git
67
+ cd webmock
68
+ rake install
69
+
70
+ ## Upgrading from v1.x to v2.x
71
+
72
+ WebMock 2.x has changed somewhat since version 1.x. Changes are listed in [CHANGELOG.md](CHANGELOG.md)
73
+
74
+ ### Cucumber
75
+
76
+ Create a file `features/support/webmock.rb` with the following contents:
77
+
78
+ ```ruby
79
+ require 'webmock/cucumber'
80
+ ```
81
+
82
+ ### MiniTest
83
+
84
+ Add the following code to `test/test_helper`:
85
+
86
+ ```ruby
87
+ require 'webmock/minitest'
88
+ ```
89
+
90
+ ### RSpec
91
+
92
+ Add the following code to `spec/spec_helper`:
93
+
94
+ ```ruby
95
+ require 'webmock/rspec'
96
+ ```
97
+
98
+ ### Test::Unit
99
+
100
+ Add the following code to `test/test_helper.rb`
101
+
102
+ ```ruby
103
+ require 'webmock/test_unit'
104
+ ```
105
+
106
+ ### Outside a test framework
107
+
108
+ You can also use WebMock outside a test framework:
109
+
110
+ ```ruby
111
+ require 'webmock'
112
+ include WebMock::API
113
+
114
+ WebMock.enable!
115
+ ```
116
+
117
+ # Examples
118
+
119
+ ## Stubbing
120
+
121
+ ### Stubbed request based on uri only and with the default response
122
+
123
+ ```ruby
124
+ stub_request(:any, "www.example.com")
125
+
126
+ Net::HTTP.get("www.example.com", "/") # ===> Success
127
+ ```
128
+
129
+ ### Stubbing requests based on method, uri, body and headers
130
+
131
+ ```ruby
132
+ stub_request(:post, "www.example.com").
133
+ with(body: "abc", headers: { 'Content-Length' => 3 })
134
+
135
+ uri = URI.parse("http://www.example.com/")
136
+ req = Net::HTTP::Post.new(uri.path)
137
+ req['Content-Length'] = 3
138
+
139
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
140
+ http.request(req, "abc")
141
+ end # ===> Success
142
+ ```
143
+
144
+ ### Matching request body and headers against regular expressions
145
+
146
+ ```ruby
147
+ stub_request(:post, "www.example.com").
148
+ with(body: /world$/, headers: {"Content-Type" => /image\/.+/}).
149
+ to_return(body: "abc")
150
+
151
+ uri = URI.parse('http://www.example.com/')
152
+ req = Net::HTTP::Post.new(uri.path)
153
+ req['Content-Type'] = 'image/png'
154
+
155
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
156
+ http.request(req, 'hello world')
157
+ end # ===> Success
158
+ ```
159
+
160
+ ### Matching request body against a hash. Body can be URL-Encoded, JSON or XML.
161
+
162
+ ```ruby
163
+ stub_request(:post, "www.example.com").
164
+ with(body: {data: {a: '1', b: 'five'}})
165
+
166
+ RestClient.post('www.example.com', "data[a]=1&data[b]=five",
167
+ content_type: 'application/x-www-form-urlencoded') # ===> Success
168
+
169
+ RestClient.post('www.example.com', '{"data":{"a":"1","b":"five"}}',
170
+ content_type: 'application/json') # ===> Success
171
+
172
+ RestClient.post('www.example.com', '<data a="1" b="five" />',
173
+ content_type: 'application/xml') # ===> Success
174
+ ```
175
+
176
+ ### Matching request body against partial hash.
177
+
178
+ ```ruby
179
+ stub_request(:post, "www.example.com").
180
+ with(body: hash_including({data: {a: '1', b: 'five'}}))
181
+
182
+ RestClient.post('www.example.com', "data[a]=1&data[b]=five&x=1",
183
+ :content_type => 'application/x-www-form-urlencoded') # ===> Success
184
+ ```
185
+
186
+ ### Matching custom request headers
187
+
188
+ ```ruby
189
+ stub_request(:any, "www.example.com").
190
+ with(headers:{ 'Header-Name' => 'Header-Value' })
191
+
192
+ uri = URI.parse('http://www.example.com/')
193
+ req = Net::HTTP::Post.new(uri.path)
194
+ req['Header-Name'] = 'Header-Value'
195
+
196
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
197
+ http.request(req, 'abc')
198
+ end # ===> Success
199
+ ```
200
+
201
+ ### Matching multiple headers with the same name
202
+
203
+ ```ruby
204
+ stub_request(:get, 'www.example.com').
205
+ with(headers: {'Accept' => ['image/jpeg', 'image/png'] })
206
+
207
+ req = Net::HTTP::Get.new("/")
208
+ req['Accept'] = ['image/png']
209
+ req.add_field('Accept', 'image/jpeg')
210
+ Net::HTTP.start("www.example.com") {|http| http.request(req) } # ===> Success
211
+ ```
212
+
213
+ ### Matching requests against provided block
214
+
215
+ ```ruby
216
+ stub_request(:post, "www.example.com").with { |request| request.body == "abc" }
217
+ RestClient.post('www.example.com', 'abc') # ===> Success
218
+ ```
219
+
220
+ ### Request with basic authentication header
221
+
222
+ ```ruby
223
+ stub_request(:get, "www.example.com").with(basic_auth: ['user', 'pass'])
224
+ # or
225
+ # stub_request(:get, "www.example.com").
226
+ # with(headers: {'Authorization' => "Basic #{ Base64.strict_encode64('user:pass').chomp}"})
227
+
228
+ Net::HTTP.start('www.example.com') do |http|
229
+ req = Net::HTTP::Get.new('/')
230
+ req.basic_auth 'user', 'pass'
231
+ http.request(req)
232
+ end # ===> Success
233
+ ```
234
+
235
+ ##### Important! Since version 2.0.0, WebMock does not match credentials provided in Authorization header and credentials provided in the userinfo of a url. I.e. `stub_request(:get, "user:pass@www.example.com")` does not match a request with credentials provided in the Authorization header.
236
+
237
+ ### Request with basic authentication in the url
238
+
239
+ ```ruby
240
+ stub_request(:get, "user:pass@www.example.com")
241
+
242
+ RestClient.get('user:pass@www.example.com') # ===> Success
243
+ ```
244
+
245
+ ### Matching uris using regular expressions
246
+
247
+ ```ruby
248
+ stub_request(:any, /example/)
249
+
250
+ Net::HTTP.get('www.example.com', '/') # ===> Success
251
+ ```
252
+
253
+ ### Matching uris using lambda
254
+
255
+ ```ruby
256
+ stub_request(:any, ->(uri) { true })
257
+ ```
258
+
259
+ ### Matching uris using RFC 6570 - Basic Example
260
+
261
+ ```ruby
262
+ uri_template = Addressable::Template.new "www.example.com/{id}/"
263
+ stub_request(:any, uri_template)
264
+
265
+ Net::HTTP.get('www.example.com', '/webmock/') # ===> Success
266
+ ```
267
+
268
+ ### Matching uris using RFC 6570 - Advanced Example
269
+
270
+ ```ruby
271
+ uri_template =
272
+ Addressable::Template.new "www.example.com/thing/{id}.json{?x,y,z}{&other*}"
273
+ stub_request(:any, uri_template)
274
+
275
+ Net::HTTP.get('www.example.com',
276
+ '/thing/5.json?x=1&y=2&z=3&anyParam=4') # ===> Success
277
+ ```
278
+
279
+ ### Matching query params using hash
280
+
281
+ ```ruby
282
+ stub_request(:get, "www.example.com").with(query: {"a" => ["b", "c"]})
283
+
284
+ RestClient.get("http://www.example.com/?a[]=b&a[]=c") # ===> Success
285
+ ```
286
+
287
+ ### Matching partial query params using hash
288
+
289
+ ```ruby
290
+ stub_request(:get, "www.example.com").
291
+ with(query: hash_including({"a" => ["b", "c"]}))
292
+
293
+ RestClient.get("http://www.example.com/?a[]=b&a[]=c&x=1") # ===> Success
294
+ ```
295
+
296
+ ### Matching partial query params using hash_excluding
297
+
298
+ ```ruby
299
+ stub_request(:get, "www.example.com").
300
+ with(query: hash_excluding({"a" => "b"}))
301
+
302
+ RestClient.get("http://www.example.com/?a=b") # ===> Failure
303
+ RestClient.get("http://www.example.com/?a=c") # ===> Success
304
+ ```
305
+
306
+ ### Stubbing with custom response
307
+
308
+ ```ruby
309
+ stub_request(:any, "www.example.com").
310
+ to_return(body: "abc", status: 200,
311
+ headers: { 'Content-Length' => 3 })
312
+
313
+ Net::HTTP.get("www.example.com", '/') # ===> "abc"
314
+ ```
315
+
316
+ Set appropriate Content-Type for HTTParty's `parsed_response`.
317
+
318
+ ```ruby
319
+ stub_request(:any, "www.example.com").to_return body: '{}', headers: {content_type: 'application/json'}
320
+ ```
321
+
322
+ ### Response with body specified as IO object
323
+
324
+ ```ruby
325
+ File.open('/tmp/response_body.txt', 'w') { |f| f.puts 'abc' }
326
+
327
+ stub_request(:any, "www.example.com").
328
+ to_return(body: File.new('/tmp/response_body.txt'), status: 200)
329
+
330
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
331
+ ```
332
+
333
+ ### Response with custom status message
334
+
335
+ ```ruby
336
+ stub_request(:any, "www.example.com").
337
+ to_return(status: [500, "Internal Server Error"])
338
+
339
+ req = Net::HTTP::Get.new("/")
340
+ Net::HTTP.start("www.example.com") { |http| http.request(req) }.
341
+ message # ===> "Internal Server Error"
342
+ ```
343
+
344
+ ### Replaying raw responses recorded with `curl -is`
345
+
346
+ ```
347
+ curl -is www.example.com > /tmp/example_curl_-is_output.txt
348
+ ```
349
+
350
+ ```ruby
351
+ raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
352
+ ```
353
+
354
+ from file
355
+
356
+ ```ruby
357
+ stub_request(:get, "www.example.com").to_return(raw_response_file)
358
+ ```
359
+
360
+ or string
361
+
362
+ ```ruby
363
+ stub_request(:get, "www.example.com").to_return(raw_response_file.read)
364
+ ```
365
+
366
+ ### Responses dynamically evaluated from block
367
+
368
+ ```ruby
369
+ stub_request(:any, 'www.example.net').
370
+ to_return { |request| {body: request.body} }
371
+
372
+ RestClient.post('www.example.net', 'abc') # ===> "abc\n"
373
+ ```
374
+
375
+ ### Responses dynamically evaluated from lambda
376
+
377
+ ```ruby
378
+ stub_request(:any, 'www.example.net').
379
+ to_return(lambda { |request| {body: request.body} })
380
+
381
+ RestClient.post('www.example.net', 'abc') # ===> "abc\n"
382
+ ```
383
+
384
+ ### Dynamically evaluated raw responses recorded with `curl -is`
385
+
386
+ `curl -is www.example.com > /tmp/www.example.com.txt`
387
+ ```ruby
388
+ stub_request(:get, "www.example.com").
389
+ to_return(lambda { |request| File.new("/tmp/#{request.uri.host.to_s}.txt") })
390
+ ```
391
+
392
+ ### Responses with dynamically evaluated parts
393
+
394
+ ```ruby
395
+ stub_request(:any, 'www.example.net').
396
+ to_return(body: lambda { |request| request.body })
397
+
398
+ RestClient.post('www.example.net', 'abc') # ===> "abc\n"
399
+ ```
400
+
401
+ ### Rack responses
402
+
403
+ ```ruby
404
+ class MyRackApp
405
+ def self.call(env)
406
+ [200, {}, ["Hello"]]
407
+ end
408
+ end
409
+
410
+ stub_request(:get, "www.example.com").to_rack(MyRackApp)
411
+
412
+ RestClient.post('www.example.com') # ===> "Hello"
413
+ ```
414
+
415
+ ### Raising errors
416
+
417
+ #### Exception declared by class
418
+
419
+ ```ruby
420
+ stub_request(:any, 'www.example.net').to_raise(StandardError)
421
+
422
+ RestClient.post('www.example.net', 'abc') # ===> StandardError
423
+ ```
424
+
425
+ #### or by exception instance
426
+
427
+ ```ruby
428
+ stub_request(:any, 'www.example.net').to_raise(StandardError.new("some error"))
429
+ ```
430
+
431
+ #### or by string
432
+
433
+ ```ruby
434
+ stub_request(:any, 'www.example.net').to_raise("some error")
435
+ ```
436
+
437
+ ### Raising timeout errors
438
+
439
+ ```ruby
440
+ stub_request(:any, 'www.example.net').to_timeout
441
+
442
+ RestClient.post('www.example.net', 'abc') # ===> RestClient::RequestTimeout
443
+ ```
444
+
445
+ ### Multiple responses for repeated requests
446
+
447
+ ```ruby
448
+ stub_request(:get, "www.example.com").
449
+ to_return({body: "abc"}, {body: "def"})
450
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
451
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
452
+
453
+ #after all responses are used the last response will be returned infinitely
454
+
455
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
456
+ ```
457
+
458
+ ### Multiple responses using chained `to_return()`, `to_raise()` or `to_timeout` declarations
459
+
460
+ ```ruby
461
+ stub_request(:get, "www.example.com").
462
+ to_return({body: "abc"}).then. #then() is just a syntactic sugar
463
+ to_return({body: "def"}).then.
464
+ to_raise(MyException)
465
+
466
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
467
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
468
+ Net::HTTP.get('www.example.com', '/') # ===> MyException raised
469
+ ```
470
+
471
+ ### Specifying number of times given response should be returned
472
+
473
+ ```ruby
474
+ stub_request(:get, "www.example.com").
475
+ to_return({body: "abc"}).times(2).then.
476
+ to_return({body: "def"})
477
+
478
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
479
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
480
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
481
+ ```
482
+
483
+ ### Removing unused stubs
484
+
485
+ ```ruby
486
+ stub_get = stub_request(:get, "www.example.com")
487
+ remove_request_stub(stub_get)
488
+ ```
489
+
490
+ ### Real requests to network can be allowed or disabled
491
+
492
+ ```ruby
493
+ WebMock.allow_net_connect!
494
+
495
+ stub_request(:any, "www.example.com").to_return(body: "abc")
496
+
497
+ Net::HTTP.get('www.example.com', '/') # ===> "abc"
498
+
499
+ Net::HTTP.get('www.something.com', '/') # ===> /.+Something.+/
500
+
501
+ WebMock.disable_net_connect!
502
+
503
+ Net::HTTP.get('www.something.com', '/') # ===> Failure
504
+ ```
505
+
506
+ ### External requests can be disabled while allowing localhost
507
+
508
+ ```ruby
509
+ WebMock.disable_net_connect!(allow_localhost: true)
510
+
511
+ Net::HTTP.get('www.something.com', '/') # ===> Failure
512
+
513
+ Net::HTTP.get('localhost:9887', '/') # ===> Allowed. Perhaps to Selenium?
514
+ ```
515
+
516
+ ### External requests can be disabled while allowing specific requests
517
+
518
+ Allowed requests can be specified in a number of ways.
519
+
520
+ With a `String` specifying a host name:
521
+
522
+ ```ruby
523
+ WebMock.disable_net_connect!(allow: 'www.example.org')
524
+
525
+ RestClient.get('www.something.com', '/') # ===> Failure
526
+ RestClient.get('www.example.org', '/') # ===> Allowed
527
+ RestClient.get('www.example.org:8080', '/') # ===> Allowed
528
+ ```
529
+
530
+ With a `String` specifying a host name and a port:
531
+
532
+ ```ruby
533
+ WebMock.disable_net_connect!(allow: 'www.example.org:8080')
534
+
535
+ RestClient.get('www.something.com', '/') # ===> Failure
536
+ RestClient.get('www.example.org', '/') # ===> Failure
537
+ RestClient.get('www.example.org:8080', '/') # ===> Allowed
538
+ ```
539
+
540
+ With a `Regexp` matching the URI:
541
+
542
+ ```ruby
543
+ WebMock.disable_net_connect!(allow: %r{ample.org/foo})
544
+
545
+ RestClient.get('www.example.org', '/foo/bar') # ===> Allowed
546
+ RestClient.get('sample.org', '/foo') # ===> Allowed
547
+ RestClient.get('sample.org', '/bar') # ===> Failure
548
+ ```
549
+
550
+ With an object that responds to `#call`, receiving a `URI` object and returning a boolean:
551
+
552
+ ```ruby
553
+ blacklist = ['google.com', 'facebook.com', 'apple.com']
554
+ allowed_sites = lambda{|uri|
555
+ blacklist.none?{|site| uri.host.include?(site) }
556
+ }
557
+ WebMock.disable_net_connect!(allow: allowed_sites)
558
+
559
+ RestClient.get('www.example.org', '/') # ===> Allowed
560
+ RestClient.get('www.facebook.com', '/') # ===> Failure
561
+ RestClient.get('apple.com', '/') # ===> Failure
562
+ ```
563
+
564
+ With an `Array` of any of the above:
565
+
566
+ ```ruby
567
+ WebMock.disable_net_connect!(allow: [
568
+ lambda{|uri| uri.host.length % 2 == 0 },
569
+ /ample.org/,
570
+ 'bbc.co.uk',
571
+ ])
572
+
573
+ RestClient.get('www.example.org', '/') # ===> Allowed
574
+ RestClient.get('bbc.co.uk', '/') # ===> Allowed
575
+ RestClient.get('bbc.com', '/') # ===> Allowed
576
+ RestClient.get('www.bbc.com', '/') # ===> Failure
577
+ ```
578
+
579
+ ## Connecting on Net::HTTP.start
580
+
581
+ HTTP protocol has 3 steps: connect, request and response (or 4 with close). Most Ruby HTTP client libraries
582
+ treat connect as a part of request step, with the exception of `Net::HTTP` which
583
+ allows opening connection to the server separately to the request, by using `Net::HTTP.start`.
584
+
585
+ WebMock API was also designed with connect being part of request step, and it only allows stubbing
586
+ requests, not connections. When `Net::HTTP.start` is called, WebMock doesn't know yet whether
587
+ a request is stubbed or not. WebMock by default delays a connection until the request is invoked,
588
+ so when there is no request, `Net::HTTP.start` doesn't do anything.
589
+ **This means that WebMock breaks the Net::HTTP behaviour by default!**
590
+
591
+ To workaround this issue, WebMock offers `:net_http_connect_on_start` option,
592
+ which can be passed to `WebMock.allow_net_connect!` and `WebMock.disable_net_connect!` methods, i.e.
593
+
594
+ ```ruby
595
+ WebMock.allow_net_connect!(net_http_connect_on_start: true)
596
+ ```
597
+
598
+ This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`.
599
+
600
+ ## Setting Expectations
601
+
602
+ ### Setting expectations in Test::Unit
603
+
604
+ ```ruby
605
+ require 'webmock/test_unit'
606
+
607
+ stub_request(:any, "www.example.com")
608
+
609
+ uri = URI.parse('http://www.example.com/')
610
+ req = Net::HTTP::Post.new(uri.path)
611
+ req['Content-Length'] = 3
612
+
613
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
614
+ http.request(req, 'abc')
615
+ end
616
+
617
+ assert_requested :post, "http://www.example.com",
618
+ headers: {'Content-Length' => 3}, body: "abc",
619
+ times: 1 # ===> Success
620
+
621
+ assert_not_requested :get, "http://www.something.com" # ===> Success
622
+
623
+ assert_requested(:post, "http://www.example.com",
624
+ times: 1) { |req| req.body == "abc" }
625
+ ```
626
+
627
+ ### Expecting real (not stubbed) requests
628
+
629
+ ```ruby
630
+ WebMock.allow_net_connect!
631
+
632
+ Net::HTTP.get('www.example.com', '/') # ===> Success
633
+
634
+ assert_requested :get, "http://www.example.com" # ===> Success
635
+ ```
636
+
637
+ ### Setting expectations in Test::Unit on the stub
638
+
639
+ ```ruby
640
+ stub_get = stub_request(:get, "www.example.com")
641
+ stub_post = stub_request(:post, "www.example.com")
642
+
643
+ Net::HTTP.get('www.example.com', '/')
644
+
645
+ assert_requested(stub_get)
646
+ assert_not_requested(stub_post)
647
+ ```
648
+
649
+
650
+ ### Setting expectations in RSpec on `WebMock` module
651
+ This style is borrowed from [fakeweb-matcher](http://github.com/pat/fakeweb-matcher)
652
+
653
+ ```ruby
654
+ require 'webmock/rspec'
655
+
656
+ expect(WebMock).to have_requested(:get, "www.example.com").
657
+ with(body: "abc", headers: {'Content-Length' => 3}).twice
658
+
659
+ expect(WebMock).not_to have_requested(:get, "www.something.com")
660
+
661
+ expect(WebMock).to have_requested(:post, "www.example.com").
662
+ with { |req| req.body == "abc" }
663
+ # Note that the block with `do ... end` instead of curly brackets won't work!
664
+ # Why? See this comment https://github.com/bblimke/webmock/issues/174#issuecomment-34908908
665
+
666
+ expect(WebMock).to have_requested(:get, "www.example.com").
667
+ with(query: {"a" => ["b", "c"]})
668
+
669
+ expect(WebMock).to have_requested(:get, "www.example.com").
670
+ with(query: hash_including({"a" => ["b", "c"]}))
671
+
672
+ expect(WebMock).to have_requested(:get, "www.example.com").
673
+ with(body: {"a" => ["b", "c"]},
674
+ headers: {'Content-Type' => 'application/json'})
675
+ ```
676
+
677
+ ### Setting expectations in RSpec with `a_request`
678
+
679
+ ```ruby
680
+ expect(a_request(:post, "www.example.com").
681
+ with(body: "abc", headers: {'Content-Length' => 3})).
682
+ to have_been_made.once
683
+
684
+ expect(a_request(:post, "www.something.com")).to have_been_made.times(3)
685
+
686
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_least_once
687
+
688
+ expect(a_request(:post, "www.something.com")).
689
+ to have_been_made.at_least_times(3)
690
+
691
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_most_twice
692
+
693
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_most_times(3)
694
+
695
+ expect(a_request(:any, "www.example.com")).not_to have_been_made
696
+
697
+ expect(a_request(:post, "www.example.com").with { |req| req.body == "abc" }).
698
+ to have_been_made
699
+
700
+ expect(a_request(:get, "www.example.com").with(query: {"a" => ["b", "c"]})).
701
+ to have_been_made
702
+
703
+ expect(a_request(:get, "www.example.com").
704
+ with(query: hash_including({"a" => ["b", "c"]}))).to have_been_made
705
+
706
+ expect(a_request(:post, "www.example.com").
707
+ with(body: {"a" => ["b", "c"]},
708
+ headers: {'Content-Type' => 'application/json'})).to have_been_made
709
+ ```
710
+
711
+ ### Setting expectations in RSpec on the stub
712
+
713
+ ```ruby
714
+ stub = stub_request(:get, "www.example.com")
715
+ # ... make requests ...
716
+ expect(stub).to have_been_requested
717
+ ```
718
+
719
+ ## Clearing stubs and request history
720
+
721
+ If you want to reset all current stubs and history of requests use `WebMock.reset!`
722
+
723
+ ```ruby
724
+ stub_request(:any, "www.example.com")
725
+
726
+ Net::HTTP.get('www.example.com', '/') # ===> Success
727
+
728
+ WebMock.reset!
729
+
730
+ Net::HTTP.get('www.example.com', '/') # ===> Failure
731
+
732
+ assert_not_requested :get, "www.example.com" # ===> Success
733
+ ```
734
+
735
+ ## Clearing request counters
736
+
737
+ If you want to reset **only** the counters of the executed requests use `WebMock.reset_executed_requests!`
738
+
739
+ ```ruby
740
+ stub = stub_request(:get, "www.example.com")
741
+ stub2 = stub_request(:get, "www.example2.com")
742
+
743
+ Net::HTTP.get('www.example.com', '/')
744
+ Net::HTTP.get('www.example.com', '/')
745
+
746
+ Net::HTTP.get('www.example2.com', '/')
747
+
748
+ expect(stub).to have_been_requested.times(2)
749
+ expect(stub2).to have_been_requested.times(1)
750
+
751
+ WebMock.reset_executed_requests!
752
+
753
+ expect(stub).not_to have_been_requested
754
+ expect(stub2).not_to have_been_requested
755
+ ```
756
+
757
+ ## Disabling and enabling WebMock or only some http client adapters
758
+
759
+ ```ruby
760
+ # Disable WebMock (all adapters)
761
+ WebMock.disable!
762
+
763
+ # Disable WebMock for all libs except Net::HTTP
764
+ WebMock.disable!(except: [:net_http])
765
+
766
+ # Enable WebMock (all adapters)
767
+ WebMock.enable!
768
+
769
+ # Enable WebMock for all libs except Patron
770
+ WebMock.enable!(except: [:patron])
771
+ ```
772
+
773
+ ## Matching requests
774
+
775
+ An executed request matches stubbed request if it passes following criteria:
776
+
777
+ - When request URI matches stubbed request URI string, Regexp pattern or RFC 6570 URI Template
778
+ - And request method is the same as stubbed request method or stubbed request method is :any
779
+ - And request body is the same as stubbed request body or stubbed request body is not specified
780
+ - And request headers match stubbed request headers, or stubbed request headers match a subset of request headers, or stubbed request headers are not specified
781
+ - And request matches provided block or block is not provided
782
+
783
+ ## Precedence of stubs
784
+
785
+ Always the last declared stub matching the request will be applied i.e:
786
+
787
+ ```ruby
788
+ stub_request(:get, "www.example.com").to_return(body: "abc")
789
+ stub_request(:get, "www.example.com").to_return(body: "def")
790
+
791
+ Net::HTTP.get('www.example.com', '/') # ====> "def"
792
+ ```
793
+
794
+ ## Matching URIs
795
+
796
+ WebMock will match all different representations of the same URI.
797
+
798
+ I.e all the following representations of the URI are equal:
799
+
800
+ ```ruby
801
+ "www.example.com"
802
+ "www.example.com/"
803
+ "www.example.com:80"
804
+ "www.example.com:80/"
805
+ "http://www.example.com"
806
+ "http://www.example.com/"
807
+ "http://www.example.com:80"
808
+ "http://www.example.com:80/"
809
+ ```
810
+
811
+ The following URIs with userinfo are also equal for WebMock
812
+
813
+ ```ruby
814
+ "a b:pass@www.example.com"
815
+ "a b:pass@www.example.com/"
816
+ "a b:pass@www.example.com:80"
817
+ "a b:pass@www.example.com:80/"
818
+ "http://a b:pass@www.example.com"
819
+ "http://a b:pass@www.example.com/"
820
+ "http://a b:pass@www.example.com:80"
821
+ "http://a b:pass@www.example.com:80/"
822
+ "a%20b:pass@www.example.com"
823
+ "a%20b:pass@www.example.com/"
824
+ "a%20b:pass@www.example.com:80"
825
+ "a%20b:pass@www.example.com:80/"
826
+ "http://a%20b:pass@www.example.com"
827
+ "http://a%20b:pass@www.example.com/"
828
+ "http://a%20b:pass@www.example.com:80"
829
+ "http://a%20b:pass@www.example.com:80/"
830
+ ```
831
+
832
+ or these
833
+
834
+ ```ruby
835
+ "www.example.com/my path/?a=my param&b=c"
836
+ "www.example.com/my%20path/?a=my%20param&b=c"
837
+ "www.example.com:80/my path/?a=my param&b=c"
838
+ "www.example.com:80/my%20path/?a=my%20param&b=c"
839
+ "http://www.example.com/my path/?a=my param&b=c"
840
+ "http://www.example.com/my%20path/?a=my%20param&b=c"
841
+ "http://www.example.com:80/my path/?a=my param&b=c"
842
+ "http://www.example.com:80/my%20path/?a=my%20param&b=c"
843
+ ```
844
+
845
+ If you provide Regexp to match URI, WebMock will try to match it against every valid form of the same url.
846
+
847
+ I.e `/my path/` will match `www.example.com/my%20path` because it is equivalent of `www.example.com/my path`
848
+
849
+ ## Matching with URI Templates
850
+
851
+ If you use [Addressable::Template](https://github.com/sporkmonger/addressable#uri-templates) for matching, then WebMock will defer the matching rules to Addressable, which complies with [RFC 6570](http://tools.ietf.org/html/rfc6570).
852
+
853
+ If you use any of the WebMock methods for matching query params, then Addressable will be used to match the base URI and WebMock will match the query params. If you do not, then WebMock will let Addressable match the full URI.
854
+
855
+ ## Matching headers
856
+
857
+ WebMock will match request headers against stubbed request headers in the following situations:
858
+
859
+ 1. Stubbed request has headers specified and request headers are the same as stubbed headers <br/>
860
+ i.e stubbed headers: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`, requested: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`
861
+
862
+ 2. Stubbed request has headers specified and stubbed request headers are a subset of request headers <br/>
863
+ i.e stubbed headers: `{ 'Header1' => 'Value1' }`, requested: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`
864
+
865
+ 3. Stubbed request has no headers <br/>
866
+ i.e stubbed headers: `nil`, requested: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`
867
+
868
+ WebMock normalises headers and treats all forms of same headers as equal:
869
+ i.e the following two sets of headers are equal:
870
+
871
+ `{ "Header1" => "value1", content_length: 123, X_CuStOm_hEAder: :value }`
872
+
873
+ `{ header1: "value1", "Content-Length" => 123, "x-cuSTOM-HeAder" => "value" }`
874
+
875
+ ## Recording real requests and responses and replaying them later
876
+
877
+ To record your application's real HTTP interactions and replay them later in tests you can use [VCR](https://github.com/vcr/vcr) with WebMock.
878
+
879
+ ## Request callbacks
880
+
881
+ #### WebMock can invoke callbacks stubbed or real requests:
882
+
883
+ ```ruby
884
+ WebMock.after_request do |request_signature, response|
885
+ puts "Request #{request_signature} was made and #{response} was returned"
886
+ end
887
+ ```
888
+
889
+ #### invoke callbacks for real requests only and except requests made with Patron
890
+
891
+ ```ruby
892
+ WebMock.after_request(except: [:patron],
893
+ real_requests_only: true) do |req_signature, response|
894
+ puts "Request #{req_signature} was made and #{response} was returned"
895
+ end
896
+ ```
897
+
898
+ ## Bugs and Issues
899
+
900
+ Please submit them here [http://github.com/bblimke/webmock/issues](http://github.com/bblimke/webmock/issues)
901
+
902
+ ## Issue triage [![Open Source Helpers](https://www.codetriage.com/bblimke/webmock/badges/users.svg)](https://www.codetriage.com/bblimke/webmock)
903
+
904
+ You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to webmock on CodeTriage](https://www.codetriage.com/bblimke/webmock).
905
+
906
+ ## Suggestions
907
+
908
+ If you have any suggestions on how to improve WebMock please send an email to the mailing list [groups.google.com/group/webmock-users](http://groups.google.com/group/webmock-users)
909
+
910
+ I'm particularly interested in how the DSL could be improved.
911
+
912
+ ## Development
913
+
914
+ In order to work on Webmock you first need to fork and clone the repo.
915
+ Please do any work on a dedicated branch and rebase against master
916
+ before sending a pull request.
917
+
918
+ ## Credits
919
+
920
+ The initial lines of this project were written during New Bamboo [Hack Day](http://blog.new-bamboo.co.uk/2009/11/13/hackday-results)
921
+ Thanks to my fellow [Bambinos](http://new-bamboo.co.uk/) for all the great suggestions!
922
+
923
+ People who submitted patches and new features or suggested improvements. Many thanks to these people:
924
+
925
+ * Ben Pickles
926
+ * Mark Evans
927
+ * Ivan Vega
928
+ * Piotr Usewicz
929
+ * Nick Plante
930
+ * Nick Quaranto
931
+ * Diego E. "Flameeyes" Pettenò
932
+ * Niels Meersschaert
933
+ * Mack Earnhardt
934
+ * Arvicco
935
+ * Sergio Gil
936
+ * Jeffrey Jones
937
+ * Tekin Suleyman
938
+ * Tom Ward
939
+ * Nadim Bitar
940
+ * Myron Marston
941
+ * Sam Phillips
942
+ * Jose Angel Cortinas
943
+ * Razic
944
+ * Steve Tooke
945
+ * Nathaniel Bibler
946
+ * Martyn Loughran
947
+ * Muness Alrubaie
948
+ * Charles Li
949
+ * Ryan Bigg
950
+ * Pete Higgins
951
+ * Hans de Graaff
952
+ * Alastair Brunton
953
+ * Sam Stokes
954
+ * Eugene Bolshakov
955
+ * James Conroy-Finn
956
+ * Salvador Fuentes Jr
957
+ * Alex Rothenberg
958
+ * Aidan Feldman
959
+ * Steve Hull
960
+ * Jay Adkisson
961
+ * Zach Dennis
962
+ * Nikita Fedyashev
963
+ * Lin Jen-Shin
964
+ * David Yeu
965
+ * Andreas Garnæs
966
+ * Roman Shterenzon
967
+ * Chris McGrath
968
+ * Stephen Celis
969
+ * Eugene Pimenov
970
+ * Albert Llop
971
+ * Christopher Pickslay
972
+ * Tammer Saleh
973
+ * Nicolas Fouché
974
+ * Joe Van Dyk
975
+ * Mark Abramov
976
+ * Frank Schumacher
977
+ * Dimitrij Denissenko
978
+ * Marnen Laibow-Koser
979
+ * Evgeniy Dolzhenko
980
+ * Nick Recobra
981
+ * Jordan Elver
982
+ * Joe Karayusuf
983
+ * Paul Cortens
984
+ * jugyo
985
+ * aindustries
986
+ * Eric Oestrich
987
+ * erwanlr
988
+ * Ben Bleything
989
+ * Jon Leighton
990
+ * Ryan Schlesinger
991
+ * Julien Boyer
992
+ * Kevin Glowacz
993
+ * Hans Hasselberg
994
+ * Andrew France
995
+ * Jonathan Hyman
996
+ * Rex Feng
997
+ * Pavel Forkert
998
+ * Jordi Massaguer Pla
999
+ * Jake Benilov
1000
+ * Tom Beauvais
1001
+ * Mokevnin Kirill
1002
+ * Alex Grant
1003
+ * Lucas Dohmen
1004
+ * Bastien Vaucher
1005
+ * Joost Baaij
1006
+ * Joel Chippindale
1007
+ * Murahashi Sanemat Kenichi
1008
+ * Tim Kurvers
1009
+ * Ilya Vassilevsky
1010
+ * gotwalt
1011
+ * Leif Bladt
1012
+ * Alex Tomlins
1013
+ * Mitsutaka Mimura
1014
+ * Tomy Kaira
1015
+ * Daniel van Hoesel
1016
+ * Ian Asaff
1017
+ * Ian Lesperance
1018
+ * Matthew Horan
1019
+ * Dmitry Gutov
1020
+ * Florian Dütsch
1021
+ * Manuel Meurer
1022
+ * Brian D. Burns
1023
+ * Riley Strong
1024
+ * Tamir Duberstein
1025
+ * Stefano Uliari
1026
+ * Alex Stupakov
1027
+ * Karen Wang
1028
+ * Matt Burke
1029
+ * Jon Rowe
1030
+ * Aleksey V. Zapparov
1031
+ * Praveen Arimbrathodiyil
1032
+ * Bo Jeanes
1033
+ * Matthew Conway
1034
+ * Rob Olson
1035
+ * Max Lincoln
1036
+ * Oleg Gritsenko
1037
+ * Hwan-Joon Choi
1038
+ * SHIBATA Hiroshi
1039
+ * Caleb Thompson
1040
+ * Theo Hultberg
1041
+ * Pablo Jairala
1042
+ * Insoo Buzz Jung
1043
+ * Carlos Alonso Pérez
1044
+ * trlorenz
1045
+ * Alexander Simonov
1046
+ * Thorbjørn Hermanse
1047
+ * Mark Lorenz
1048
+ * tjsousa
1049
+ * Tasos Stathopoulos
1050
+ * Dan Buettner
1051
+ * Sven Riedel
1052
+ * Mark Lorenz
1053
+ * Dávid Kovács
1054
+ * fishermand46
1055
+ * Franky Wahl
1056
+ * ChaYoung You
1057
+ * Simon Russell
1058
+ * Steve Mitchell
1059
+ * Mattias Putman
1060
+ * Zachary Anker
1061
+ * Emmanuel Sambo
1062
+ * Ramon Tayag
1063
+ * Johannes Schlumberger
1064
+ * Siôn Le Roux
1065
+ * Matt Palmer
1066
+ * Zhao Wen
1067
+ * Krzysztof Rygielski
1068
+ * Magne Land
1069
+ * yurivm
1070
+ * Mike Knepper
1071
+ * Charles Pence
1072
+ * Alexey Zapparov
1073
+ * Pablo Brasero
1074
+ * Cedric Pimenta
1075
+ * Michiel Karnebeek
1076
+ * Alex Kestner
1077
+ * Manfred Stienstra
1078
+ * Tim Diggins
1079
+ * Gabriel Chaney
1080
+ * Chris Griego
1081
+ * Taiki Ono
1082
+ * Jonathan Schatz
1083
+ * Jose Luis Honorato
1084
+ * Aaron Kromer
1085
+ * Pavel Jurašek
1086
+ * Jake Worth
1087
+ * Gabe Martin-Dempesy
1088
+ * Michael Grosser
1089
+ * Aleksei Maridashvili
1090
+ * Ville Lautanala
1091
+ * Koichi ITO
1092
+ * Jordan Harband
1093
+ * Tarmo Tänav
1094
+ * Joe Marty
1095
+ * Chris Thomson
1096
+ * Vít Ondruch
1097
+ * George Ulmer
1098
+ * Christof Koenig
1099
+ * Chung-Yi Chi
1100
+ * Olexandr Hoshylyk
1101
+ * Janko Marohnić
1102
+ * Pat Allan
1103
+ * Rick Song
1104
+ * NARUSE, Yui
1105
+ * Piotr Boniecki
1106
+ * Olia Kremmyda
1107
+ * Michał Matyas
1108
+ * Matt Brictson
1109
+ * Kenny Ortmann
1110
+ * redbar0n
1111
+ * Lukas Pokorny
1112
+ * Arkadiy Tetelman
1113
+ * Kazato Sugimoto
1114
+ * Olle Jonsson
1115
+ * Pavel Rosický
1116
+ * Geremia Taglialatela
1117
+ * Koichi Sasada
1118
+ * Yusuke Endoh
1119
+ * Grey Baker
1120
+ * SoonKhen OwYong
1121
+ * Pavel Valena
1122
+ * Adam Sokolnicki
1123
+ * Jeff Felchner
1124
+ * Eike Send
1125
+ * Claudio Poli
1126
+ * Csaba Apagyi
1127
+ * Frederick Cheung
1128
+ * Fábio D. Batista
1129
+ * Andriy Yanko
1130
+ * y-yagi
1131
+ * Rafael França
1132
+ * George Claghorn
1133
+ * Alex Junger
1134
+ * Orien Madgwick
1135
+ * Andrei Sidorov
1136
+ * Marco Costa
1137
+ * Ryan Davis
1138
+ * Brandur
1139
+ * Samuel Williams
1140
+ * Patrik Ragnarsson
1141
+ * Alex Coomans
1142
+ * Vesa Laakso
1143
+ * John Hawthorn
1144
+ * guppy0356
1145
+ * Thilo Rusche
1146
+ * Andrew Stuntz
1147
+ * Lucas Uyezu
1148
+ * Bruno Sutic
1149
+ * Ryan Kerr
1150
+ * Adam Harwood
1151
+ * Ben Koshy
1152
+ * Jesse Bowes
1153
+ * Marek Kasztelnik
1154
+ * ce07c3
1155
+ * Jun Jiang
1156
+ * Oleksiy Kovyrin
1157
+ * Matt Larraz
1158
+ * Tony Schneider
1159
+ * Niklas Hösl
1160
+ * Johanna Hartmann
1161
+ * Alex Vondrak
1162
+ * Will Storey
1163
+
1164
+ For a full list of contributors you can visit the
1165
+ [contributors](https://github.com/bblimke/webmock/contributors) page.
1166
+
1167
+ ## Background
1168
+
1169
+ Thank you Fakeweb! This library was inspired by [FakeWeb](http://fakeweb.rubyforge.org).
1170
+ I imported some solutions from that project to WebMock. I also copied some code i.e Net:HTTP adapter.
1171
+ Fakeweb architecture unfortunately didn't allow me to extend it easily with the features I needed.
1172
+ I also preferred some things to work differently i.e request stub precedence.
1173
+
1174
+ ## Copyright
1175
+
1176
+ Copyright (c) 2009-2010 Bartosz Blimke. See LICENSE for details.