vagrant-unbundled 2.0.0.1 → 2.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (351) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/CHANGELOG.md +34 -0
  4. data/Gemfile.lock +10 -10
  5. data/README.md +2 -2
  6. data/contrib/sudoers/linux-suse +6 -7
  7. data/lib/vagrant/plugin/v2/command.rb +3 -0
  8. data/lib/vagrant/plugin/v2/communicator.rb +1 -1
  9. data/lib/vagrant/registry.rb +1 -1
  10. data/lib/vagrant/util/downloader.rb +1 -2
  11. data/lib/vagrant/util/is_port_open.rb +2 -1
  12. data/lib/vagrant/util/keypair.rb +1 -1
  13. data/lib/vagrant/util/platform.rb +39 -23
  14. data/plugins/commands/destroy/command.rb +31 -10
  15. data/plugins/communicators/ssh/communicator.rb +1 -0
  16. data/plugins/communicators/winrm/helper.rb +6 -1
  17. data/plugins/guests/solaris11/cap/change_host_name.rb +0 -2
  18. data/plugins/guests/solaris11/cap/configure_networks.rb +1 -7
  19. data/plugins/guests/solaris11/plugin.rb +5 -35
  20. data/plugins/guests/windows/cap/public_key.rb +2 -0
  21. data/plugins/guests/windows/guest_network.rb +3 -3
  22. data/plugins/guests/windows/scripts/reboot_detect.ps1 +5 -0
  23. data/plugins/providers/docker/driver.rb +1 -1
  24. data/plugins/providers/docker/executor/local.rb +4 -0
  25. data/plugins/providers/docker/executor/vagrant.rb +4 -0
  26. data/plugins/providers/hyperv/scripts/import_vm_vmcx.ps1 +1 -1
  27. data/plugins/providers/virtualbox/driver/meta.rb +1 -0
  28. data/plugins/providers/virtualbox/driver/version_5_2.rb +16 -0
  29. data/plugins/providers/virtualbox/plugin.rb +1 -0
  30. data/plugins/providers/virtualbox/synced_folder.rb +1 -1
  31. data/plugins/provisioners/chef/provisioner/chef_client.rb +30 -23
  32. data/plugins/provisioners/chef/provisioner/chef_solo.rb +26 -19
  33. data/plugins/provisioners/chef/provisioner/chef_zero.rb +29 -22
  34. data/plugins/provisioners/puppet/provisioner/puppet.rb +23 -4
  35. data/plugins/provisioners/salt/bootstrap-salt.ps1 +15 -3
  36. data/plugins/provisioners/salt/bootstrap-salt.sh +2 -0
  37. data/plugins/provisioners/salt/config.rb +11 -0
  38. data/plugins/provisioners/salt/provisioner.rb +10 -7
  39. data/plugins/provisioners/shell/provisioner.rb +1 -1
  40. data/templates/locales/en.yml +5 -0
  41. data/test/unit/base.rb +2 -0
  42. data/test/unit/plugins/commands/destroy/command_test.rb +155 -0
  43. data/test/unit/plugins/communicators/winrm/helper_test.rb +33 -0
  44. data/test/unit/plugins/guests/solaris11/cap/change_host_name_test.rb +36 -0
  45. data/test/unit/plugins/guests/solaris11/cap/configure_networks_test.rb +56 -0
  46. data/test/unit/plugins/providers/virtualbox/synced_folder_test.rb +26 -0
  47. data/test/unit/plugins/provisioners/salt/config_test.rb +42 -0
  48. data/test/unit/plugins/provisioners/salt/provisioner_test.rb +16 -1
  49. data/test/unit/plugins/provisioners/shell/config_test.rb +3 -3
  50. data/test/unit/plugins/pushes/local-exec/config_test.rb +2 -2
  51. data/test/unit/vagrant/util/downloader_test.rb +28 -0
  52. data/test/unit/vagrant/util/platform_test.rb +58 -0
  53. data/vagrant.gemspec +1 -1
  54. data/vendor/bundle/ruby/2.4.0/bin/rwinrmcp +5 -0
  55. data/vendor/bundle/ruby/2.4.0/bin/vagrant +5 -0
  56. data/vendor/bundle/ruby/2.4.0/bin/vagrant-spec +5 -0
  57. data/vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/vagrant-spec.gemspec +3 -3
  58. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/CHANGELOG.md +216 -0
  59. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/Gemfile +32 -0
  60. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/LICENSE.txt +202 -0
  61. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/README.md +121 -0
  62. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/Rakefile +32 -0
  63. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/data/unicode.data +0 -0
  64. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/idna/native.rb +59 -0
  65. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/idna/pure.rb +677 -0
  66. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/idna.rb +25 -0
  67. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/template.rb +1065 -0
  68. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/uri.rb +2492 -0
  69. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable/version.rb +30 -0
  70. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/lib/addressable.rb +2 -0
  71. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/idna_spec.rb +298 -0
  72. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/net_http_compat_spec.rb +28 -0
  73. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/rack_mount_compat_spec.rb +104 -0
  74. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/security_spec.rb +57 -0
  75. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/template_spec.rb +1419 -0
  76. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/addressable/uri_spec.rb +6468 -0
  77. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/spec/spec_helper.rb +21 -0
  78. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/clobber.rake +2 -0
  79. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/gem.rake +91 -0
  80. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/git.rake +45 -0
  81. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/metrics.rake +22 -0
  82. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/rspec.rake +21 -0
  83. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/yard.rake +27 -0
  84. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.gitignore +15 -0
  85. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.rspec +1 -0
  86. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.travis.yml +13 -0
  87. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/.yardopts +1 -0
  88. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/Gemfile +6 -0
  89. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/LICENSE +19 -0
  90. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/README.md +265 -0
  91. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/Rakefile +13 -0
  92. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/changelog.md +72 -0
  93. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/hashdiff.gemspec +25 -0
  94. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/diff.rb +232 -0
  95. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/lcs.rb +69 -0
  96. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/linear_compare_array.rb +155 -0
  97. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/patch.rb +88 -0
  98. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/util.rb +146 -0
  99. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff/version.rb +3 -0
  100. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/lib/hashdiff.rb +6 -0
  101. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/best_diff_spec.rb +74 -0
  102. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/diff_array_spec.rb +60 -0
  103. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/diff_spec.rb +339 -0
  104. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/lcs_spec.rb +75 -0
  105. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/linear_compare_array_spec.rb +48 -0
  106. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/patch_spec.rb +183 -0
  107. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/hashdiff/util_spec.rb +78 -0
  108. data/vendor/bundle/ruby/2.4.0/gems/hashdiff-0.3.7/spec/spec_helper.rb +13 -0
  109. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/CHANGELOG.md +250 -0
  110. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/CONTRIBUTING.md +46 -0
  111. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/LICENSE.md +20 -0
  112. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/README.md +122 -0
  113. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapter.rb +49 -0
  114. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapter_error.rb +15 -0
  115. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/gson.rb +20 -0
  116. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/jr_jackson.rb +25 -0
  117. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/json_common.rb +23 -0
  118. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/json_gem.rb +11 -0
  119. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/json_pure.rb +11 -0
  120. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/nsjsonserialization.rb +32 -0
  121. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/oj.rb +25 -0
  122. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/ok_json.rb +23 -0
  123. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/adapters/yajl.rb +19 -0
  124. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/convertible_hash_keys.rb +43 -0
  125. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/options.rb +39 -0
  126. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/options_cache.rb +29 -0
  127. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/parse_error.rb +17 -0
  128. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/vendor/okjson.rb +606 -0
  129. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json/version.rb +17 -0
  130. data/vendor/bundle/ruby/2.4.0/gems/multi_json-1.12.2/lib/multi_json.rb +161 -0
  131. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.gitignore +11 -0
  132. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.rubocop.yml +32 -0
  133. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.rubocop_defaults.yml +177 -0
  134. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.travis.yml +24 -0
  135. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/.yardopts +1 -0
  136. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/2.0-Upgrade.md +52 -0
  137. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/CHANGELOG.md +330 -0
  138. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/Gemfile +10 -0
  139. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/LICENSE.txt +22 -0
  140. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/README.md +202 -0
  141. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/Rakefile +49 -0
  142. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/bin/console +14 -0
  143. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/data/list.txt +12288 -0
  144. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/domain.rb +235 -0
  145. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/errors.rb +39 -0
  146. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/list.rb +243 -0
  147. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/rule.rb +348 -0
  148. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix/version.rb +10 -0
  149. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/lib/public_suffix.rb +175 -0
  150. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/public_suffix.gemspec +25 -0
  151. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/.empty +2 -0
  152. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/acceptance_test.rb +127 -0
  153. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_find.rb +66 -0
  154. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_find_all.rb +102 -0
  155. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_names.rb +91 -0
  156. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_select.rb +26 -0
  157. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_select_incremental.rb +25 -0
  158. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/benchmarks/bm_valid.rb +101 -0
  159. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/domain_profiler.rb +12 -0
  160. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/find_profiler.rb +12 -0
  161. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/find_profiler_jp.rb +12 -0
  162. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/initialization_profiler.rb +11 -0
  163. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/list_profsize.rb +11 -0
  164. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/profilers/object_binsize.rb +57 -0
  165. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/psl_test.rb +49 -0
  166. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/test_helper.rb +13 -0
  167. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/tests.txt +98 -0
  168. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/domain_test.rb +104 -0
  169. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/errors_test.rb +23 -0
  170. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/list_test.rb +239 -0
  171. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/public_suffix_test.rb +186 -0
  172. data/vendor/bundle/ruby/2.4.0/gems/public_suffix-3.0.1/test/unit/rule_test.rb +220 -0
  173. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.gemtest +0 -0
  174. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.gitignore +34 -0
  175. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.rspec-tm +2 -0
  176. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/.travis.yml +24 -0
  177. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/CHANGELOG.md +1460 -0
  178. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/Gemfile +9 -0
  179. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/LICENSE +20 -0
  180. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/README.md +1045 -0
  181. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/Rakefile +30 -0
  182. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/api.rb +97 -0
  183. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/assertion_failure.rb +11 -0
  184. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/callback_registry.rb +35 -0
  185. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/config.rb +18 -0
  186. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/cucumber.rb +10 -0
  187. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/deprecation.rb +9 -0
  188. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/errors.rb +17 -0
  189. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/curb_adapter.rb +337 -0
  190. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +228 -0
  191. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/excon_adapter.rb +162 -0
  192. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
  193. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
  194. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/client.rb +14 -0
  195. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/request.rb +10 -0
  196. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/response.rb +43 -0
  197. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/streamer.rb +25 -0
  198. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
  199. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
  200. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/httpclient_adapter.rb +240 -0
  201. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/manticore_adapter.rb +127 -0
  202. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/net_http.rb +362 -0
  203. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
  204. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
  205. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
  206. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/matchers/hash_including_matcher.rb +36 -0
  207. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/minitest.rb +41 -0
  208. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rack_response.rb +69 -0
  209. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_body_diff.rb +64 -0
  210. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_execution_verifier.rb +78 -0
  211. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_pattern.rb +343 -0
  212. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_registry.rb +35 -0
  213. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_signature.rb +54 -0
  214. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_signature_snippet.rb +61 -0
  215. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/request_stub.rb +100 -0
  216. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/response.rb +153 -0
  217. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/responses_sequence.rb +40 -0
  218. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
  219. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec/matchers/webmock_matcher.rb +52 -0
  220. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec/matchers.rb +27 -0
  221. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/rspec.rb +35 -0
  222. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/stub_registry.rb +67 -0
  223. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/stub_request_snippet.rb +34 -0
  224. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/test_unit.rb +22 -0
  225. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/hash_counter.rb +32 -0
  226. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/hash_keys_stringifier.rb +25 -0
  227. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/hash_validator.rb +17 -0
  228. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/headers.rb +49 -0
  229. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/json.rb +78 -0
  230. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/query_mapper.rb +279 -0
  231. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/uri.rb +111 -0
  232. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/util/version_checker.rb +111 -0
  233. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/version.rb +3 -0
  234. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock/webmock.rb +156 -0
  235. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/lib/webmock.rb +54 -0
  236. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/minitest/test_helper.rb +34 -0
  237. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/minitest/test_webmock.rb +9 -0
  238. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/minitest/webmock_spec.rb +60 -0
  239. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/curb/curb_spec.rb +466 -0
  240. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/curb/curb_spec_helper.rb +147 -0
  241. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/em_http_request/em_http_request_spec.rb +406 -0
  242. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +77 -0
  243. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/excon/excon_spec.rb +75 -0
  244. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/excon/excon_spec_helper.rb +50 -0
  245. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/http_rb/http_rb_spec.rb +73 -0
  246. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/http_rb/http_rb_spec_helper.rb +51 -0
  247. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/httpclient/httpclient_spec.rb +209 -0
  248. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
  249. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec.rb +56 -0
  250. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
  251. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/net_http_shared.rb +142 -0
  252. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/net_http_spec.rb +317 -0
  253. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
  254. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
  255. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/patron/patron_spec.rb +118 -0
  256. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/patron/patron_spec_helper.rb +54 -0
  257. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
  258. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/callbacks.rb +147 -0
  259. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
  260. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
  261. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
  262. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/request_expectations.rb +916 -0
  263. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/returning_declared_responses.rb +388 -0
  264. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/shared/stubbing_requests.rb +583 -0
  265. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
  266. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
  267. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/acceptance/webmock_shared.rb +41 -0
  268. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/fixtures/test.txt +1 -0
  269. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/quality_spec.rb +84 -0
  270. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/spec_helper.rb +48 -0
  271. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/example_curl_output.txt +22 -0
  272. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/failures.rb +9 -0
  273. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/my_rack_app.rb +53 -0
  274. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/network_connection.rb +19 -0
  275. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/support/webmock_server.rb +69 -0
  276. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/api_spec.rb +75 -0
  277. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/errors_spec.rb +129 -0
  278. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
  279. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
  280. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
  281. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/rack_response_spec.rb +112 -0
  282. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_body_diff_spec.rb +90 -0
  283. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_execution_verifier_spec.rb +208 -0
  284. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_pattern_spec.rb +590 -0
  285. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_registry_spec.rb +76 -0
  286. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_signature_snippet_spec.rb +89 -0
  287. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_signature_spec.rb +155 -0
  288. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/request_stub_spec.rb +199 -0
  289. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/response_spec.rb +282 -0
  290. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/stub_registry_spec.rb +103 -0
  291. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/stub_request_snippet_spec.rb +95 -0
  292. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/hash_counter_spec.rb +39 -0
  293. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
  294. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/headers_spec.rb +28 -0
  295. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/json_spec.rb +33 -0
  296. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/query_mapper_spec.rb +138 -0
  297. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/uri_spec.rb +299 -0
  298. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/util/version_checker_spec.rb +65 -0
  299. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/spec/unit/webmock_spec.rb +11 -0
  300. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/http_request.rb +24 -0
  301. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/shared_test.rb +95 -0
  302. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/test_helper.rb +23 -0
  303. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/test/test_webmock.rb +6 -0
  304. data/vendor/bundle/ruby/2.4.0/gems/webmock-2.3.2/webmock.gemspec +46 -0
  305. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.gitignore +11 -0
  306. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.rspec +3 -0
  307. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.rubocop.yml +9 -0
  308. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/.travis.yml +9 -0
  309. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/Gemfile +5 -0
  310. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/LICENSE +202 -0
  311. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/README.md +79 -0
  312. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/Rakefile +28 -0
  313. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/VERSION +1 -0
  314. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/Vagrantfile +9 -0
  315. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/appveyor.yml +38 -0
  316. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/bin/rwinrmcp +86 -0
  317. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/changelog.md +60 -0
  318. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/core/file_transporter.rb +527 -0
  319. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/core/tmp_zip.rb +177 -0
  320. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/exceptions.rb +28 -0
  321. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/file_manager.rb +118 -0
  322. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
  323. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
  324. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
  325. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
  326. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/download.ps1.erb +8 -0
  327. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
  328. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
  329. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs/scripts/scripts.rb +31 -0
  330. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/lib/winrm-fs.rb +28 -0
  331. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/config-example.yml +3 -0
  332. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/integration/file_manager_spec.rb +224 -0
  333. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/integration/tmp_zip_spec.rb +26 -0
  334. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/matchers.rb +58 -0
  335. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/spec_helper.rb +71 -0
  336. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/spec/unit/tmp_zip_spec.rb +79 -0
  337. data/vendor/bundle/ruby/2.4.0/gems/winrm-fs-1.1.1/winrm-fs.gemspec +37 -0
  338. data/vendor/bundle/ruby/2.4.0/specifications/addressable-2.5.2.gemspec +39 -0
  339. data/vendor/bundle/ruby/2.4.0/specifications/hashdiff-0.3.7.gemspec +39 -0
  340. data/vendor/bundle/ruby/2.4.0/specifications/multi_json-1.12.2.gemspec +33 -0
  341. data/vendor/bundle/ruby/2.4.0/specifications/public_suffix-3.0.1.gemspec +41 -0
  342. data/vendor/bundle/ruby/2.4.0/specifications/webmock-2.3.2.gemspec +79 -0
  343. data/vendor/bundle/ruby/2.4.0/specifications/winrm-fs-1.1.1.gemspec +57 -0
  344. data/version.txt +1 -1
  345. metadata +295 -11
  346. data/plugins/guests/solaris11/cap/halt.rb +0 -26
  347. data/plugins/guests/solaris11/cap/insert_public_key.rb +0 -21
  348. data/plugins/guests/solaris11/cap/mount_virtualbox_shared_folder.rb +0 -45
  349. data/plugins/guests/solaris11/cap/remove_public_key.rb +0 -21
  350. data/plugins/guests/solaris11/cap/rsync.rb +0 -29
  351. data/test/unit/plugins/guests/solaris11/cap/halt_test.rb +0 -44
@@ -0,0 +1,9 @@
1
+ source 'http://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,1045 @@
1
+ WebMock
2
+ =======
3
+ [![Gem Version](https://badge.fury.io/rb/webmock.svg)](http://badge.fury.io/rb/webmock) [![Build Status](https://secure.travis-ci.org/bblimke/webmock.svg?branch=master)](http://travis-ci.org/bblimke/webmock) [![Dependency Status](https://gemnasium.com/bblimke/webmock.svg)](http://gemnasium.com/bblimke/webmock) [![Code Climate](https://codeclimate.com/github/bblimke/webmock/badges/gpa.svg)](https://codeclimate.com/github/bblimke/webmock) [![Inline docs](http://inch-ci.org/github/bblimke/webmock.svg?branch=master)](http://inch-ci.org/github/bblimke/webmock)
4
+
5
+ Library for stubbing and setting expectations on HTTP requests in Ruby.
6
+
7
+ Features
8
+ --------
9
+
10
+ * Stubbing HTTP requests at low http client lib level (no need to change tests when you change HTTP library)
11
+ * Setting and verifying expectations on HTTP requests
12
+ * Matching requests based on method, URI, headers and body
13
+ * Smart matching of the same URIs in different representations (also encoded and non encoded forms)
14
+ * Smart matching of the same headers in different representations.
15
+ * Support for Test::Unit
16
+ * Support for RSpec
17
+ * Support for MiniTest
18
+
19
+ Supported HTTP libraries
20
+ ------------------------
21
+
22
+ * Net::HTTP and libraries based on Net::HTTP (i.e RightHttpConnection, REST Client, HTTParty)
23
+ * HTTPClient
24
+ * Patron
25
+ * EM-HTTP-Request
26
+ * Curb (currently only Curb::Easy)
27
+ * Typhoeus (currently only Typhoeus::Hydra)
28
+ * Excon
29
+ * HTTP Gem
30
+ * Manticore
31
+
32
+ Supported Ruby Interpreters
33
+ ---------------------------
34
+
35
+ * MRI 1.9.3
36
+ * MRI 2.0.0
37
+ * MRI 2.1
38
+ * MRI 2.2
39
+ * MRI 2.3
40
+ * MRI 2.4
41
+ * JRuby
42
+ * Rubinius
43
+
44
+ ## Installation
45
+
46
+ gem install webmock
47
+
48
+ ### or to install the latest development version from github master
49
+
50
+ git clone http://github.com/bblimke/webmock.git
51
+ cd webmock
52
+ rake install
53
+
54
+ ## Upgrading from v1.x to v2.x
55
+
56
+ WebMock 2.x has changed somewhat since version 1.x. Changes are listed in [CHANGELOG.md](CHANGELOG.md)
57
+
58
+ ### Test::Unit
59
+
60
+ Add the following code to `test/test_helper.rb`
61
+
62
+ ```ruby
63
+ require 'webmock/test_unit'
64
+ ```
65
+
66
+ ### RSpec
67
+
68
+ Add the following code to `spec/spec_helper`:
69
+
70
+ ```ruby
71
+ require 'webmock/rspec'
72
+ ```
73
+
74
+ ### MiniTest
75
+
76
+ Add the following code to `test/test_helper`:
77
+
78
+ ```ruby
79
+ require 'webmock/minitest'
80
+ ```
81
+
82
+ ### Cucumber
83
+
84
+ Create a file `features/support/webmock.rb` with the following contents:
85
+
86
+ ```ruby
87
+ require 'webmock/cucumber'
88
+ ```
89
+
90
+ ### Outside a test framework
91
+
92
+ You can also use WebMock outside a test framework:
93
+
94
+ ```ruby
95
+ require 'webmock'
96
+ include WebMock::API
97
+
98
+ WebMock.enable!
99
+ ```
100
+
101
+ ## Examples
102
+
103
+
104
+
105
+ ## Stubbing
106
+
107
+
108
+ ### Stubbed request based on uri only and with the default response
109
+
110
+ ```ruby
111
+ stub_request(:any, "www.example.com")
112
+
113
+ Net::HTTP.get("www.example.com", "/") # ===> Success
114
+ ```
115
+
116
+ ### Stubbing requests based on method, uri, body and headers
117
+
118
+ ```ruby
119
+ stub_request(:post, "www.example.com").
120
+ with(body: "abc", headers: { 'Content-Length' => 3 })
121
+
122
+ uri = URI.parse("http://www.example.com/")
123
+ req = Net::HTTP::Post.new(uri.path)
124
+ req['Content-Length'] = 3
125
+
126
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
127
+ http.request(req, "abc")
128
+ end # ===> Success
129
+ ```
130
+
131
+ ### Matching request body and headers against regular expressions
132
+
133
+ ```ruby
134
+ stub_request(:post, "www.example.com").
135
+ with(body: /^.*world$/, headers: {"Content-Type" => /image\/.+/}).
136
+ to_return(body: "abc")
137
+
138
+ uri = URI.parse('http://www.example.com/')
139
+ req = Net::HTTP::Post.new(uri.path)
140
+ req['Content-Type'] = 'image/png'
141
+
142
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
143
+ http.request(req, 'hello world')
144
+ end # ===> Success
145
+ ```
146
+
147
+ ### Matching request body against a hash. Body can be URL-Encoded, JSON or XML.
148
+
149
+ ```ruby
150
+ stub_request(:post, "www.example.com").
151
+ with(body: {data: {a: '1', b: 'five'}})
152
+
153
+ RestClient.post('www.example.com', "data[a]=1&data[b]=five",
154
+ content_type: 'application/x-www-form-urlencoded') # ===> Success
155
+
156
+ RestClient.post('www.example.com', '{"data":{"a":"1","b":"five"}}',
157
+ content_type: 'application/json') # ===> Success
158
+
159
+ RestClient.post('www.example.com', '<data a="1" b="five" />',
160
+ content_type: 'application/xml') # ===> Success
161
+ ```
162
+
163
+ ### Matching request body against partial hash.
164
+
165
+ ```ruby
166
+ stub_request(:post, "www.example.com").
167
+ with(body: hash_including({data: {a: '1', b: 'five'}}))
168
+
169
+ RestClient.post('www.example.com', "data[a]=1&data[b]=five&x=1",
170
+ :content_type => 'application/x-www-form-urlencoded') # ===> Success
171
+ ```
172
+
173
+ ### Matching custom request headers
174
+
175
+ ```ruby
176
+ stub_request(:any, "www.example.com").
177
+ with(headers:{ 'Header-Name' => 'Header-Value' })
178
+
179
+ uri = URI.parse('http://www.example.com/')
180
+ req = Net::HTTP::Post.new(uri.path)
181
+ req['Header-Name'] = 'Header-Value'
182
+
183
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
184
+ http.request(req, 'abc')
185
+ end # ===> Success
186
+ ```
187
+
188
+ ### Matching multiple headers with the same name
189
+
190
+ ```ruby
191
+ stub_request(:get, 'www.example.com').
192
+ with(headers: {'Accept' => ['image/jpeg', 'image/png'] })
193
+
194
+ req = Net::HTTP::Get.new("/")
195
+ req['Accept'] = ['image/png']
196
+ req.add_field('Accept', 'image/jpeg')
197
+ Net::HTTP.start("www.example.com") {|http| http.request(req) } # ===> Success
198
+ ```
199
+
200
+ ### Matching requests against provided block
201
+
202
+ ```ruby
203
+ stub_request(:post, "www.example.com").with { |request| request.body == "abc" }
204
+ RestClient.post('www.example.com', 'abc') # ===> Success
205
+ ```
206
+
207
+ ### Request with basic authentication header
208
+
209
+ ```ruby
210
+ stub_request(:get, "www.example.com").with(basic_auth: ['user', 'pass'])
211
+ # or
212
+ # stub_request(:get, "www.example.com").
213
+ # with(headers: {'Authorization' => "Basic #{ Base64.strict_encode64('user:pass').chomp}"})
214
+
215
+ Net::HTTP.start('www.example.com') do |http|
216
+ req = Net::HTTP::Get.new('/')
217
+ req.basic_auth 'user', 'pass'
218
+ http.request(req)
219
+ end # ===> Success
220
+ ```
221
+
222
+ ##### 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.
223
+
224
+ ### Request with basic authentication in the url
225
+
226
+ ```ruby
227
+ stub_request(:get, "user:pass@www.example.com")
228
+
229
+ RestClient.get('user:pass@www.example.com') # ===> Success
230
+ ```
231
+
232
+ ### Matching uris using regular expressions
233
+
234
+ ```ruby
235
+ stub_request(:any, /.*example.*/)
236
+
237
+ Net::HTTP.get('www.example.com', '/') # ===> Success
238
+ ```
239
+
240
+ ### Matching uris using RFC 6570 - Basic Example
241
+
242
+ ```ruby
243
+ uri_template = Addressable::Template.new "www.example.com/{id}/"
244
+ stub_request(:any, uri_template)
245
+
246
+ Net::HTTP.get('www.example.com', '/webmock/') # ===> Success
247
+ ```
248
+
249
+ ### Matching uris using RFC 6570 - Advanced Example
250
+
251
+ ```ruby
252
+ uri_template =
253
+ Addressable::Template.new "www.example.com/thing/{id}.json{?x,y,z}{&other*}"
254
+ stub_request(:any, uri_template)
255
+
256
+ Net::HTTP.get('www.example.com',
257
+ '/thing/5.json?x=1&y=2&z=3&anyParam=4') # ===> Success
258
+ ```
259
+
260
+ ### Matching query params using hash
261
+
262
+ ```ruby
263
+ stub_request(:get, "www.example.com").with(query: {"a" => ["b", "c"]})
264
+
265
+ RestClient.get("http://www.example.com/?a[]=b&a[]=c") # ===> Success
266
+ ```
267
+
268
+ ### Matching partial query params using hash
269
+
270
+ ```ruby
271
+ stub_request(:get, "www.example.com").
272
+ with(query: hash_including({"a" => ["b", "c"]}))
273
+
274
+ RestClient.get("http://www.example.com/?a[]=b&a[]=c&x=1") # ===> Success
275
+ ```
276
+
277
+ ### Stubbing with custom response
278
+
279
+ ```ruby
280
+ stub_request(:any, "www.example.com").
281
+ to_return(body: "abc", status: 200,
282
+ headers: { 'Content-Length' => 3 })
283
+
284
+ Net::HTTP.get("www.example.com", '/') # ===> "abc"
285
+ ```
286
+
287
+ ### Response with body specified as IO object
288
+
289
+ ```ruby
290
+ File.open('/tmp/response_body.txt', 'w') { |f| f.puts 'abc' }
291
+
292
+ stub_request(:any, "www.example.com").
293
+ to_return(body: File.new('/tmp/response_body.txt'), status: 200)
294
+
295
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
296
+ ```
297
+
298
+ ### Response with custom status message
299
+
300
+ ```ruby
301
+ stub_request(:any, "www.example.com").
302
+ to_return(status: [500, "Internal Server Error"])
303
+
304
+ req = Net::HTTP::Get.new("/")
305
+ Net::HTTP.start("www.example.com") { |http| http.request(req) }.
306
+ message # ===> "Internal Server Error"
307
+ ```
308
+
309
+ ### Replaying raw responses recorded with `curl -is`
310
+
311
+ ```
312
+ curl -is www.example.com > /tmp/example_curl_-is_output.txt
313
+ ```
314
+
315
+ ```ruby
316
+ raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
317
+ ```
318
+
319
+ from file
320
+
321
+ ```ruby
322
+ stub_request(:get, "www.example.com").to_return(raw_response_file)
323
+ ```
324
+
325
+ or string
326
+
327
+ ```ruby
328
+ stub_request(:get, "www.example.com").to_return(raw_response_file.read)
329
+ ```
330
+
331
+ ### Responses dynamically evaluated from block
332
+
333
+ ```ruby
334
+ stub_request(:any, 'www.example.net').
335
+ to_return { |request| {body: request.body} }
336
+
337
+ RestClient.post('www.example.net', 'abc') # ===> "abc\n"
338
+ ```
339
+
340
+ ### Responses dynamically evaluated from lambda
341
+
342
+ ```ruby
343
+ stub_request(:any, 'www.example.net').
344
+ to_return(lambda { |request| {body: request.body} })
345
+
346
+ RestClient.post('www.example.net', 'abc') # ===> "abc\n"
347
+ ```
348
+
349
+ ### Dynamically evaluated raw responses recorded with `curl -is`
350
+
351
+ `curl -is www.example.com > /tmp/www.example.com.txt`
352
+ ```ruby
353
+ stub_request(:get, "www.example.com").
354
+ to_return(lambda { |request| File.new("/tmp/#{request.uri.host.to_s}.txt") })
355
+ ```
356
+
357
+ ### Responses with dynamically evaluated parts
358
+
359
+ ```ruby
360
+ stub_request(:any, 'www.example.net').
361
+ to_return(body: lambda { |request| request.body })
362
+
363
+ RestClient.post('www.example.net', 'abc') # ===> "abc\n"
364
+ ```
365
+
366
+ ### Rack responses
367
+
368
+ ```ruby
369
+ class MyRackApp
370
+ def self.call(env)
371
+ [200, {}, ["Hello"]]
372
+ end
373
+ end
374
+
375
+ stub_request(:get, "www.example.com").to_rack(MyRackApp)
376
+
377
+ RestClient.post('www.example.com') # ===> "Hello"
378
+ ```
379
+
380
+ ### Raising errors
381
+
382
+ #### Exception declared by class
383
+
384
+ ```ruby
385
+ stub_request(:any, 'www.example.net').to_raise(StandardError)
386
+
387
+ RestClient.post('www.example.net', 'abc') # ===> StandardError
388
+ ```
389
+
390
+ #### or by exception instance
391
+
392
+ ```ruby
393
+ stub_request(:any, 'www.example.net').to_raise(StandardError.new("some error"))
394
+ ```
395
+
396
+ #### or by string
397
+
398
+ ```ruby
399
+ stub_request(:any, 'www.example.net').to_raise("some error")
400
+ ```
401
+
402
+ ### Raising timeout errors
403
+
404
+ ```ruby
405
+ stub_request(:any, 'www.example.net').to_timeout
406
+
407
+ RestClient.post('www.example.net', 'abc') # ===> RestClient::RequestTimeout
408
+ ```
409
+
410
+ ### Multiple responses for repeated requests
411
+
412
+ ```ruby
413
+ stub_request(:get, "www.example.com").
414
+ to_return({body: "abc"}, {body: "def"})
415
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
416
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
417
+
418
+ #after all responses are used the last response will be returned infinitely
419
+
420
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
421
+ ```
422
+
423
+ ### Multiple responses using chained `to_return()`, `to_raise()` or `to_timeout` declarations
424
+
425
+ ```ruby
426
+ stub_request(:get, "www.example.com").
427
+ to_return({body: "abc"}).then. #then() is just a syntactic sugar
428
+ to_return({body: "def"}).then.
429
+ to_raise(MyException)
430
+
431
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
432
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
433
+ Net::HTTP.get('www.example.com', '/') # ===> MyException raised
434
+ ```
435
+
436
+ ### Specifying number of times given response should be returned
437
+
438
+ ```ruby
439
+ stub_request(:get, "www.example.com").
440
+ to_return({body: "abc"}).times(2).then.
441
+ to_return({body: "def"})
442
+
443
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
444
+ Net::HTTP.get('www.example.com', '/') # ===> "abc\n"
445
+ Net::HTTP.get('www.example.com', '/') # ===> "def\n"
446
+ ```
447
+
448
+ ### Removing unused stubs
449
+
450
+ ```ruby
451
+ stub_get = stub_request(:get, "www.example.com")
452
+ remove_request_stub(stub_get)
453
+ ```
454
+
455
+ ### Real requests to network can be allowed or disabled
456
+
457
+ ```ruby
458
+ WebMock.allow_net_connect!
459
+
460
+ stub_request(:any, "www.example.com").to_return(body: "abc")
461
+
462
+ Net::HTTP.get('www.example.com', '/') # ===> "abc"
463
+
464
+ Net::HTTP.get('www.something.com', '/') # ===> /.+Something.+/
465
+
466
+ WebMock.disable_net_connect!
467
+
468
+ Net::HTTP.get('www.something.com', '/') # ===> Failure
469
+ ```
470
+
471
+ ### External requests can be disabled while allowing localhost
472
+
473
+ ```ruby
474
+ WebMock.disable_net_connect!(allow_localhost: true)
475
+
476
+ Net::HTTP.get('www.something.com', '/') # ===> Failure
477
+
478
+ Net::HTTP.get('localhost:9887', '/') # ===> Allowed. Perhaps to Selenium?
479
+ ```
480
+
481
+ ### External requests can be disabled while allowing specific requests
482
+
483
+ Allowed requests can be specified in a number of ways.
484
+
485
+ With a `String` specifying a host name:
486
+
487
+ ```ruby
488
+ WebMock.disable_net_connect!(allow: 'www.example.org')
489
+
490
+ RestClient.get('www.something.com', '/') # ===> Failure
491
+ RestClient.get('www.example.org', '/') # ===> Allowed
492
+ RestClient.get('www.example.org:8080', '/') # ===> Allowed
493
+ ```
494
+
495
+ With a `String` specifying a host name and a port:
496
+
497
+ ```ruby
498
+ WebMock.disable_net_connect!(allow: 'www.example.org:8080')
499
+
500
+ RestClient.get('www.something.com', '/') # ===> Failure
501
+ RestClient.get('www.example.org', '/') # ===> Failure
502
+ RestClient.get('www.example.org:8080', '/') # ===> Allowed
503
+ ```
504
+
505
+ With a `Regexp` matching the URI:
506
+
507
+ ```ruby
508
+ WebMock.disable_net_connect!(allow: %r{ample.org/foo})
509
+
510
+ RestClient.get('www.example.org', '/foo/bar') # ===> Allowed
511
+ RestClient.get('sample.org', '/foo') # ===> Allowed
512
+ RestClient.get('sample.org', '/bar') # ===> Failure
513
+ ```
514
+
515
+ With an object that responds to `#call`, receiving a `URI` object and returning a boolean:
516
+
517
+ ```ruby
518
+ blacklist = ['google.com', 'facebook.com', 'apple.com']
519
+ allowed_sites = lambda{|uri|
520
+ blacklist.none?{|site| uri.host.include?(site) }
521
+ }
522
+ WebMock.disable_net_connect!(allow: allowed_sites)
523
+
524
+ RestClient.get('www.example.org', '/') # ===> Allowed
525
+ RestClient.get('www.facebook.com', '/') # ===> Failure
526
+ RestClient.get('apple.com', '/') # ===> Failure
527
+ ```
528
+
529
+ With an `Array` of any of the above:
530
+
531
+ ```ruby
532
+ WebMock.disable_net_connect!(allow: [
533
+ lambda{|uri| uri.host.length % 2 == 0 },
534
+ /ample.org/,
535
+ 'bbc.co.uk',
536
+ ])
537
+
538
+ RestClient.get('www.example.org', '/') # ===> Allowed
539
+ RestClient.get('bbc.co.uk', '/') # ===> Allowed
540
+ RestClient.get('bbc.com', '/') # ===> Allowed
541
+ RestClient.get('www.bbc.com', '/') # ===> Failure
542
+ ```
543
+
544
+ ## Connecting on Net::HTTP.start
545
+
546
+ HTTP protocol has 3 steps: connect, request and response (or 4 with close). Most Ruby HTTP client libraries
547
+ treat connect as a part of request step, with the exception of `Net::HTTP` which
548
+ allows opening connection to the server separately to the request, by using `Net::HTTP.start`.
549
+
550
+ WebMock API was also designed with connect being part of request step, and it only allows stubbing
551
+ requests, not connections. When `Net::HTTP.start` is called, WebMock doesn't know yet whether
552
+ a request is stubbed or not. WebMock by default delays a connection until the request is invoked,
553
+ so when there is no request, `Net::HTTP.start` doesn't do anything.
554
+ **This means that WebMock breaks the Net::HTTP behaviour by default!**
555
+
556
+ To workaround this issue, WebMock offers `:net_http_connect_on_start` option,
557
+ which can be passed to `WebMock.allow_net_connect!` and `WebMock.disable_net_connect!` methods, i.e.
558
+
559
+ ```ruby
560
+ WebMock.allow_net_connect!(net_http_connect_on_start: true)
561
+ ```
562
+
563
+ This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`.
564
+
565
+ ## Setting Expectations
566
+
567
+ ### Setting expectations in Test::Unit
568
+
569
+ ```ruby
570
+ require 'webmock/test_unit'
571
+
572
+ stub_request(:any, "www.example.com")
573
+
574
+ uri = URI.parse('http://www.example.com/')
575
+ req = Net::HTTP::Post.new(uri.path)
576
+ req['Content-Length'] = 3
577
+
578
+ res = Net::HTTP.start(uri.host, uri.port) do |http|
579
+ http.request(req, 'abc')
580
+ end
581
+
582
+ assert_requested :post, "http://www.example.com",
583
+ headers: {'Content-Length' => 3}, body: "abc",
584
+ times: 1 # ===> Success
585
+
586
+ assert_not_requested :get, "http://www.something.com" # ===> Success
587
+
588
+ assert_requested(:post, "http://www.example.com",
589
+ times: 1) { |req| req.body == "abc" }
590
+ ```
591
+
592
+ ### Expecting real (not stubbed) requests
593
+
594
+ ```ruby
595
+ WebMock.allow_net_connect!
596
+
597
+ Net::HTTP.get('www.example.com', '/') # ===> Success
598
+
599
+ assert_requested :get, "http://www.example.com" # ===> Success
600
+ ```
601
+
602
+ ### Setting expectations in Test::Unit on the stub
603
+
604
+ ```ruby
605
+ stub_get = stub_request(:get, "www.example.com")
606
+ stub_post = stub_request(:post, "www.example.com")
607
+
608
+ Net::HTTP.get('www.example.com', '/')
609
+
610
+ assert_requested(stub_get)
611
+ assert_not_requested(stub_post)
612
+ ```
613
+
614
+
615
+ ### Setting expectations in RSpec on `WebMock` module
616
+ This style is borrowed from [fakeweb-matcher](http://github.com/pat/fakeweb-matcher)
617
+
618
+ ```ruby
619
+ require 'webmock/rspec'
620
+
621
+ expect(WebMock).to have_requested(:get, "www.example.com").
622
+ with(body: "abc", headers: {'Content-Length' => 3}).twice
623
+
624
+ expect(WebMock).not_to have_requested(:get, "www.something.com")
625
+
626
+ expect(WebMock).to have_requested(:post, "www.example.com").
627
+ with { |req| req.body == "abc" }
628
+ # Note that the block with `do ... end` instead of curly brackets won't work!
629
+ # Why? See this comment https://github.com/bblimke/webmock/issues/174#issuecomment-34908908
630
+
631
+ expect(WebMock).to have_requested(:get, "www.example.com").
632
+ with(query: {"a" => ["b", "c"]})
633
+
634
+ expect(WebMock).to have_requested(:get, "www.example.com").
635
+ with(query: hash_including({"a" => ["b", "c"]}))
636
+
637
+ expect(WebMock).to have_requested(:get, "www.example.com").
638
+ with(body: {"a" => ["b", "c"]},
639
+ headers: {'Content-Type' => 'application/json'})
640
+ ```
641
+
642
+ ### Setting expectations in RSpec with `a_request`
643
+
644
+ ```ruby
645
+ expect(a_request(:post, "www.example.com").
646
+ with(body: "abc", headers: {'Content-Length' => 3})).
647
+ to have_been_made.once
648
+
649
+ expect(a_request(:post, "www.something.com")).to have_been_made.times(3)
650
+
651
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_least_once
652
+
653
+ expect(a_request(:post, "www.something.com")).
654
+ to have_been_made.at_least_times(3)
655
+
656
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_most_twice
657
+
658
+ expect(a_request(:post, "www.something.com")).to have_been_made.at_most_times(3)
659
+
660
+ expect(a_request(:any, "www.example.com")).not_to have_been_made
661
+
662
+ expect(a_request(:post, "www.example.com").with { |req| req.body == "abc" }).
663
+ to have_been_made
664
+
665
+ expect(a_request(:get, "www.example.com").with(query: {"a" => ["b", "c"]})).
666
+ to have_been_made
667
+
668
+ expect(a_request(:get, "www.example.com").
669
+ with(query: hash_including({"a" => ["b", "c"]}))).to have_been_made
670
+
671
+ expect(a_request(:post, "www.example.com").
672
+ with(body: {"a" => ["b", "c"]},
673
+ headers: {'Content-Type' => 'application/json'})).to have_been_made
674
+ ```
675
+
676
+ ### Setting expectations in RSpec on the stub
677
+
678
+ ```ruby
679
+ stub = stub_request(:get, "www.example.com")
680
+ # ... make requests ...
681
+ expect(stub).to have_been_requested
682
+ ```
683
+
684
+ ## Clearing stubs and request history
685
+
686
+ If you want to reset all current stubs and history of requests use `WebMock.reset!`
687
+
688
+ ```ruby
689
+ stub_request(:any, "www.example.com")
690
+
691
+ Net::HTTP.get('www.example.com', '/') # ===> Success
692
+
693
+ WebMock.reset!
694
+
695
+ Net::HTTP.get('www.example.com', '/') # ===> Failure
696
+
697
+ assert_not_requested :get, "www.example.com" # ===> Success
698
+ ```
699
+
700
+ ## Disabling and enabling WebMock or only some http client adapters
701
+
702
+ ```ruby
703
+ # Disable WebMock (all adapters)
704
+ WebMock.disable!
705
+
706
+ # Disable WebMock for all libs except Net::HTTP
707
+ WebMock.disable!(except: [:net_http])
708
+
709
+ # Enable WebMock (all adapters)
710
+ WebMock.enable!
711
+
712
+ # Enable WebMock for all libs except Patron
713
+ WebMock.enable!(except: [:patron])
714
+ ```
715
+
716
+ ## Matching requests
717
+
718
+ An executed request matches stubbed request if it passes following criteria:
719
+
720
+ - When request URI matches stubbed request URI string, Regexp pattern or RFC 6570 URI Template
721
+ - And request method is the same as stubbed request method or stubbed request method is :any
722
+ - And request body is the same as stubbed request body or stubbed request body is not specified
723
+ - And request headers match stubbed request headers, or stubbed request headers match a subset of request headers, or stubbed request headers are not specified
724
+ - And request matches provided block or block is not provided
725
+
726
+ ## Precedence of stubs
727
+
728
+ Always the last declared stub matching the request will be applied i.e:
729
+
730
+ ```ruby
731
+ stub_request(:get, "www.example.com").to_return(body: "abc")
732
+ stub_request(:get, "www.example.com").to_return(body: "def")
733
+
734
+ Net::HTTP.get('www.example.com', '/') # ====> "def"
735
+ ```
736
+
737
+ ## Matching URIs
738
+
739
+ WebMock will match all different representations of the same URI.
740
+
741
+ I.e all the following representations of the URI are equal:
742
+
743
+ ```ruby
744
+ "www.example.com"
745
+ "www.example.com/"
746
+ "www.example.com:80"
747
+ "www.example.com:80/"
748
+ "http://www.example.com"
749
+ "http://www.example.com/"
750
+ "http://www.example.com:80"
751
+ "http://www.example.com:80/"
752
+ ```
753
+
754
+ The following URIs with userinfo are also equal for WebMock
755
+
756
+ ```ruby
757
+ "a b:pass@www.example.com"
758
+ "a b:pass@www.example.com/"
759
+ "a b:pass@www.example.com:80"
760
+ "a b:pass@www.example.com:80/"
761
+ "http://a b:pass@www.example.com"
762
+ "http://a b:pass@www.example.com/"
763
+ "http://a b:pass@www.example.com:80"
764
+ "http://a b:pass@www.example.com:80/"
765
+ "a%20b:pass@www.example.com"
766
+ "a%20b:pass@www.example.com/"
767
+ "a%20b:pass@www.example.com:80"
768
+ "a%20b:pass@www.example.com:80/"
769
+ "http://a%20b:pass@www.example.com"
770
+ "http://a%20b:pass@www.example.com/"
771
+ "http://a%20b:pass@www.example.com:80"
772
+ "http://a%20b:pass@www.example.com:80/"
773
+ ```
774
+
775
+ or these
776
+
777
+ ```ruby
778
+ "www.example.com/my path/?a=my param&b=c"
779
+ "www.example.com/my%20path/?a=my%20param&b=c"
780
+ "www.example.com:80/my path/?a=my param&b=c"
781
+ "www.example.com:80/my%20path/?a=my%20param&b=c"
782
+ "http://www.example.com/my path/?a=my param&b=c"
783
+ "http://www.example.com/my%20path/?a=my%20param&b=c"
784
+ "http://www.example.com:80/my path/?a=my param&b=c"
785
+ "http://www.example.com:80/my%20path/?a=my%20param&b=c"
786
+ ```
787
+
788
+ If you provide Regexp to match URI, WebMock will try to match it against every valid form of the same url.
789
+
790
+ I.e `/.*my path.*/` will match `www.example.com/my%20path` because it is equivalent of `www.example.com/my path`
791
+
792
+ ## Matching with URI Templates
793
+
794
+ 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).
795
+
796
+ 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.
797
+
798
+ ## Matching headers
799
+
800
+ WebMock will match request headers against stubbed request headers in the following situations:
801
+
802
+ 1. Stubbed request has headers specified and request headers are the same as stubbed headers <br/>
803
+ i.e stubbed headers: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`, requested: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`
804
+
805
+ 2. Stubbed request has headers specified and stubbed request headers are a subset of request headers <br/>
806
+ i.e stubbed headers: `{ 'Header1' => 'Value1' }`, requested: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`
807
+
808
+ 3. Stubbed request has no headers <br/>
809
+ i.e stubbed headers: `nil`, requested: `{ 'Header1' => 'Value1', 'Header2' => 'Value2' }`
810
+
811
+ WebMock normalises headers and treats all forms of same headers as equal:
812
+ i.e the following two sets of headers are equal:
813
+
814
+ `{ "Header1" => "value1", content_length: 123, X_CuStOm_hEAder: :value }`
815
+
816
+ `{ header1: "value1", "Content-Length" => 123, "x-cuSTOM-HeAder" => "value" }`
817
+
818
+ ## Recording real requests and responses and replaying them later
819
+
820
+ 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.
821
+
822
+ ## Request callbacks
823
+
824
+ #### WebMock can invoke callbacks stubbed or real requests:
825
+
826
+ ```ruby
827
+ WebMock.after_request do |request_signature, response|
828
+ puts "Request #{request_signature} was made and #{response} was returned"
829
+ end
830
+ ```
831
+
832
+ #### invoke callbacks for real requests only and except requests made with Patron
833
+
834
+ ```ruby
835
+ WebMock.after_request(except: [:patron],
836
+ real_requests_only: true) do |req_signature, response|
837
+ puts "Request #{req_signature} was made and #{response} was returned"
838
+ end
839
+ ```
840
+
841
+ ## Bugs and Issues
842
+
843
+ Please submit them here [http://github.com/bblimke/webmock/issues](http://github.com/bblimke/webmock/issues)
844
+
845
+ ## Suggestions
846
+
847
+ 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)
848
+
849
+ I'm particularly interested in how the DSL could be improved.
850
+
851
+ ## Development
852
+
853
+ In order to work on Webmock you first need to fork and clone the repo.
854
+ Please do any work on a dedicated branch and rebase against master
855
+ before sending a pull request.
856
+
857
+ ## Credits
858
+
859
+ The initial lines of this project were written during New Bamboo [Hack Day](http://blog.new-bamboo.co.uk/2009/11/13/hackday-results)
860
+ Thanks to my fellow [Bambinos](http://new-bamboo.co.uk/) for all the great suggestions!
861
+
862
+ People who submitted patches and new features or suggested improvements. Many thanks to these people:
863
+
864
+ * Ben Pickles
865
+ * Mark Evans
866
+ * Ivan Vega
867
+ * Piotr Usewicz
868
+ * Nick Plante
869
+ * Nick Quaranto
870
+ * Diego E. "Flameeyes" Pettenò
871
+ * Niels Meersschaert
872
+ * Mack Earnhardt
873
+ * Arvicco
874
+ * Sergio Gil
875
+ * Jeffrey Jones
876
+ * Tekin Suleyman
877
+ * Tom Ward
878
+ * Nadim Bitar
879
+ * Myron Marston
880
+ * Sam Phillips
881
+ * Jose Angel Cortinas
882
+ * Razic
883
+ * Steve Tooke
884
+ * Nathaniel Bibler
885
+ * Martyn Loughran
886
+ * Muness Alrubaie
887
+ * Charles Li
888
+ * Ryan Bigg
889
+ * Pete Higgins
890
+ * Hans de Graaff
891
+ * Alastair Brunton
892
+ * Sam Stokes
893
+ * Eugene Bolshakov
894
+ * James Conroy-Finn
895
+ * Salvador Fuentes Jr
896
+ * Alex Rothenberg
897
+ * Aidan Feldman
898
+ * Steve Hull
899
+ * Jay Adkisson
900
+ * Zach Dennis
901
+ * Nikita Fedyashev
902
+ * Lin Jen-Shin
903
+ * David Yeu
904
+ * Andreas Garnæs
905
+ * Roman Shterenzon
906
+ * Chris McGrath
907
+ * Stephen Celis
908
+ * Eugene Pimenov
909
+ * Albert Llop
910
+ * Christopher Pickslay
911
+ * Tammer Saleh
912
+ * Nicolas Fouché
913
+ * Joe Van Dyk
914
+ * Mark Abramov
915
+ * Frank Schumacher
916
+ * Dimitrij Denissenko
917
+ * Marnen Laibow-Koser
918
+ * Evgeniy Dolzhenko
919
+ * Nick Recobra
920
+ * Jordan Elver
921
+ * Joe Karayusuf
922
+ * Paul Cortens
923
+ * jugyo
924
+ * aindustries
925
+ * Eric Oestrich
926
+ * erwanlr
927
+ * Ben Bleything
928
+ * Jon Leighton
929
+ * Ryan Schlesinger
930
+ * Julien Boyer
931
+ * Kevin Glowacz
932
+ * Hans Hasselberg
933
+ * Andrew France
934
+ * Jonathan Hyman
935
+ * Rex Feng
936
+ * Pavel Forkert
937
+ * Jordi Massaguer Pla
938
+ * Jake Benilov
939
+ * Tom Beauvais
940
+ * Mokevnin Kirill
941
+ * Alex Grant
942
+ * Lucas Dohmen
943
+ * Bastien Vaucher
944
+ * Joost Baaij
945
+ * Joel Chippindale
946
+ * Murahashi Sanemat Kenichi
947
+ * Tim Kurvers
948
+ * Ilya Vassilevsky
949
+ * gotwalt
950
+ * Leif Bladt
951
+ * Alex Tomlins
952
+ * Mitsutaka Mimura
953
+ * Tomy Kaira
954
+ * Daniel van Hoesel
955
+ * Ian Asaff
956
+ * Ian Lesperance
957
+ * Matthew Horan
958
+ * Dmitry Gutov
959
+ * Florian Dütsch
960
+ * Manuel Meurer
961
+ * Brian D. Burns
962
+ * Riley Strong
963
+ * Tamir Duberstein
964
+ * Stefano Uliari
965
+ * Alex Stupakov
966
+ * Karen Wang
967
+ * Matt Burke
968
+ * Jon Rowe
969
+ * Aleksey V. Zapparov
970
+ * Praveen Arimbrathodiyil
971
+ * Bo Jeanes
972
+ * Matthew Conway
973
+ * Rob Olson
974
+ * Max Lincoln
975
+ * Oleg Gritsenko
976
+ * Hwan-Joon Choi
977
+ * SHIBATA Hiroshi
978
+ * Caleb Thompson
979
+ * Theo Hultberg
980
+ * Pablo Jairala
981
+ * Insoo Buzz Jung
982
+ * Carlos Alonso Pérez
983
+ * trlorenz
984
+ * Alexander Simonov
985
+ * Thorbjørn Hermanse
986
+ * Mark Lorenz
987
+ * tjsousa
988
+ * Tasos Stathopoulos
989
+ * Dan Buettner
990
+ * Sven Riedel
991
+ * Mark Lorenz
992
+ * Dávid Kovács
993
+ * fishermand46
994
+ * Franky Wahl
995
+ * ChaYoung You
996
+ * Simon Russell
997
+ * Steve Mitchell
998
+ * Mattias Putman
999
+ * Zachary Anker
1000
+ * Emmanuel Sambo
1001
+ * Ramon Tayag
1002
+ * Johannes Schlumberger
1003
+ * Siôn Le Roux
1004
+ * Matt Palmer
1005
+ * Zhao Wen
1006
+ * Krzysztof Rygielski
1007
+ * Magne Land
1008
+ * yurivm
1009
+ * Mike Knepper
1010
+ * Charles Pence
1011
+ * Alexey Zapparov
1012
+ * Pablo Brasero
1013
+ * Cedric Pimenta
1014
+ * Michiel Karnebeek
1015
+ * Alex Kestner
1016
+ * Manfred Stienstra
1017
+ * Tim Diggins
1018
+ * Gabriel Chaney
1019
+ * Chris Griego
1020
+ * Taiki Ono
1021
+ * Jonathan Schatz
1022
+ * Jose Luis Honorato
1023
+ * Aaron Kromer
1024
+ * Pavel Jurašek
1025
+ * Jake Worth
1026
+ * Gabe Martin-Dempesy
1027
+ * Michael Grosser
1028
+ * Aleksei Maridashvili
1029
+ * Ville Lautanala
1030
+ * Koichi ITO
1031
+ * Jordan Harband
1032
+
1033
+ For a full list of contributors you can visit the
1034
+ [contributors](https://github.com/bblimke/webmock/contributors) page.
1035
+
1036
+ ## Background
1037
+
1038
+ Thank you Fakeweb! This library was inspired by [FakeWeb](http://fakeweb.rubyforge.org).
1039
+ I imported some solutions from that project to WebMock. I also copied some code i.e Net:HTTP adapter.
1040
+ Fakeweb architecture unfortunately didn't allow me to extend it easily with the features I needed.
1041
+ I also preferred some things to work differently i.e request stub precedence.
1042
+
1043
+ ## Copyright
1044
+
1045
+ Copyright (c) 2009-2010 Bartosz Blimke. See LICENSE for details.