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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/README.md +2 -2
- data/lib/logstash/outputs/scalyr.rb +94 -73
- data/lib/scalyr/common/client.rb +3 -1
- data/lib/scalyr/constants.rb +2 -0
- data/logstash-output-scalyr.gemspec +1 -1
- data/spec/logstash/outputs/scalyr_integration_spec.rb +119 -8
- data/spec/logstash/outputs/scalyr_spec.rb +9 -6
- data/vendor/bundle/jruby/2.5.0/cache/addressable-2.7.0.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/crack-0.4.5.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/hashdiff-1.0.1.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/public_suffix-4.0.6.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/rexml-3.2.5.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/webmock-3.13.0.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/CHANGELOG.md +235 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Gemfile +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/LICENSE.txt +202 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/README.md +121 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Rakefile +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/data/unicode.data +0 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable.rb +4 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/native.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/pure.rb +676 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/template.rb +1045 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb +2529 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/version.rb +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/idna_spec.rb +300 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/net_http_compat_spec.rb +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/rack_mount_compat_spec.rb +106 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/security_spec.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/template_spec.rb +1451 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/uri_spec.rb +6603 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/spec_helper.rb +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/clobber.rake +4 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/gem.rake +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/git.rake +47 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/metrics.rake +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/rspec.rake +23 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/yard.rake +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack.rb +7 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/json.rb +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/util.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/version.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/xml.rb +238 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Gemfile +8 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/LICENSE +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/README.md +276 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Rakefile +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/changelog.md +100 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/hashdiff.gemspec +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/compare_hashes.rb +69 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/diff.rb +177 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs.rb +66 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/linear_compare_array.rb +159 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/patch.rb +88 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/util.rb +155 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/version.rb +5 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/best_diff_spec.rb +75 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_array_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_spec.rb +360 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/lcs_spec.rb +76 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/linear_compare_array_spec.rb +50 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/patch_spec.rb +185 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/readme_spec.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/util_spec.rb +116 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/spec_helper.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/2.0-Upgrade.md +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/CHANGELOG.md +406 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Gemfile +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/LICENSE.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/README.md +207 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Rakefile +51 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/SECURITY.md +104 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/bin/console +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/codecov.yml +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/data/list.txt +13380 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix.rb +179 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/domain.rb +235 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/errors.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/list.rb +247 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/rule.rb +350 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/version.rb +13 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/public_suffix.gemspec +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/acceptance_test.rb +131 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb +66 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find_all.rb +102 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_names.rb +91 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select.rb +26 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select_incremental.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_valid.rb +101 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/domain_profiler.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler_jp.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/initialization_profiler.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/list_profsize.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/object_binsize.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/psl_test.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/test_helper.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/tests.txt +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/domain_test.rb +106 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/errors_test.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/list_test.rb +241 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/public_suffix_test.rb +188 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/rule_test.rb +222 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/NEWS.md +178 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/README.md +48 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/context.rdoc +143 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/child.rdoc +87 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/document.rdoc +276 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/element.rdoc +602 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/node.rdoc +97 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/CHANGELOG.md +1894 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Gemfile +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/LICENSE +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/README.md +1176 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Rakefile +38 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/api.rb +109 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/assertion_failure.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/callback_registry.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/config.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/cucumber.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/deprecation.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/errors.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb +351 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +231 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/excon_adapter.rb +165 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb +259 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http.rb +385 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/any_arg_matcher.rb +13 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_including_matcher.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/minitest.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rack_response.rb +69 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_body_diff.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_execution_verifier.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_pattern.rb +405 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_registry.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature_snippet.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_stub.rb +100 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/response.rb +159 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/responses_sequence.rb +40 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb +42 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/webmock_matcher.rb +67 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_registry.rb +82 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_request_snippet.rb +38 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/test_unit.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_counter.rb +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_keys_stringifier.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_validator.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/headers.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/json.rb +67 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/query_mapper.rb +281 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/uri.rb +111 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/values_stringifier.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/version_checker.rb +111 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/version.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/webmock.rb +163 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_helper.rb +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_webmock.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/webmock_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
- 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
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec.rb +499 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec_helper.rb +147 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec.rb +462 -0
- 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
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec_helper.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec.rb +217 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec.rb +107 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_shared.rb +153 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec.rb +369 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec.rb +125 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec_helper.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/callbacks.rb +148 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/request_expectations.rb +930 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/returning_declared_responses.rb +409 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/stubbing_requests.rb +678 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/webmock_shared.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/fixtures/test.txt +1 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/quality_spec.rb +84 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/spec_helper.rb +48 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/example_curl_output.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/failures.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/my_rack_app.rb +53 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/network_connection.rb +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/webmock_server.rb +70 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/api_spec.rb +175 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/errors_spec.rb +129 -0
- 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
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/rack_response_spec.rb +112 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_body_diff_spec.rb +90 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_execution_verifier_spec.rb +208 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_pattern_spec.rb +736 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_registry_spec.rb +95 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_snippet_spec.rb +89 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_spec.rb +155 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_stub_spec.rb +199 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/response_spec.rb +286 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_registry_spec.rb +103 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_request_snippet_spec.rb +115 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_counter_spec.rb +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/headers_spec.rb +28 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/json_spec.rb +33 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/query_mapper_spec.rb +157 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/uri_spec.rb +371 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/version_checker_spec.rb +65 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/http_request.rb +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/shared_test.rb +108 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_helper.rb +23 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_webmock.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/webmock.gemspec +54 -0
- data/vendor/bundle/jruby/2.5.0/specifications/addressable-2.7.0.gemspec +39 -0
- data/vendor/bundle/jruby/2.5.0/specifications/crack-0.4.5.gemspec +32 -0
- data/vendor/bundle/jruby/2.5.0/specifications/hashdiff-1.0.1.gemspec +46 -0
- data/vendor/bundle/jruby/2.5.0/specifications/public_suffix-4.0.6.gemspec +24 -0
- data/vendor/bundle/jruby/2.5.0/specifications/rexml-3.2.5.gemspec +42 -0
- data/vendor/bundle/jruby/2.5.0/specifications/webmock-3.13.0.gemspec +85 -0
- metadata +309 -2
@@ -0,0 +1,736 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WebMock::RequestPattern do
|
4
|
+
|
5
|
+
describe "describing itself" do
|
6
|
+
it "should report string describing itself" do
|
7
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com",
|
8
|
+
body: "abc", headers: {'A' => 'a', 'B' => 'b'}).to_s).to eq(
|
9
|
+
"GET http://www.example.com/ with body \"abc\" with headers {'A'=>'a', 'B'=>'b'}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should report string describing itself with block" do
|
14
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com",
|
15
|
+
body: "abc", headers: {'A' => 'a', 'B' => 'b'}).with {|req| true}.to_s).to eq(
|
16
|
+
"GET http://www.example.com/ with body \"abc\" with headers {'A'=>'a', 'B'=>'b'} with given block"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should report string describing itself with query params" do
|
21
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/, query: {'a' => ['b', 'c']}).to_s).to eq(
|
22
|
+
"GET /.*example.*/ with query params {\"a\"=>[\"b\", \"c\"]}"
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should report string describing itself with query params as hash including matcher" do
|
27
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
|
28
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({'a' => ['b', 'c']})).to_s).to eq(
|
29
|
+
"GET /.*example.*/ with query params hash_including({\"a\"=>[\"b\", \"c\"]})"
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should report string describing itself with body as hash including matcher" do
|
34
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
|
35
|
+
body: WebMock::Matchers::HashIncludingMatcher.new({'a' => ['b', 'c']})).to_s).to eq(
|
36
|
+
"GET /.*example.*/ with body hash_including({\"a\"=>[\"b\", \"c\"]})"
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "with" do
|
42
|
+
before(:each) do
|
43
|
+
@request_pattern =WebMock::RequestPattern.new(:get, "www.example.com")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have assigned body pattern" do
|
47
|
+
@request_pattern.with(body: "abc")
|
48
|
+
expect(@request_pattern.to_s).to eq(WebMock::RequestPattern.new(:get, "www.example.com", body: "abc").to_s)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should have assigned normalized headers pattern" do
|
52
|
+
@request_pattern.with(headers: {'A' => 'a'})
|
53
|
+
expect(@request_pattern.to_s).to eq(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'A' => 'a'}).to_s)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should raise an error if options passed to `with` are invalid" do
|
57
|
+
expect { @request_pattern.with(foo: "bar") }.to raise_error('Unknown key: "foo". Valid keys are: "body", "headers", "query", "basic_auth"')
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should raise an error if neither options or block is provided" do
|
61
|
+
expect { @request_pattern.with() }.to raise_error('#with method invoked with no arguments. Either options hash or block must be specified. Created a block with do..end? Try creating it with curly braces {} instead.')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
class WebMock::RequestPattern
|
67
|
+
def match(request_signature)
|
68
|
+
self.matches?(request_signature)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "when matching" do
|
73
|
+
|
74
|
+
it "should match if uri matches and method matches" do
|
75
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com")).
|
76
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should match if uri matches and method pattern is any" do
|
80
|
+
expect(WebMock::RequestPattern.new(:any, "www.example.com")).
|
81
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should not match if request has different method" do
|
85
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com")).
|
86
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should match if uri matches request uri" do
|
90
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com")).
|
91
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should match if request has unescaped uri" do
|
95
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com/my%20path")).
|
96
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/my path"))
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should match if request has escaped uri" do
|
100
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com/my path")).
|
101
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should match if uri regexp pattern matches unescaped form of request uri" do
|
105
|
+
expect(WebMock::RequestPattern.new(:get, /.*my path.*/)).
|
106
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should match if uri regexp pattern matches request uri" do
|
110
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/)).
|
111
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should match if uri matches requesst uri as URI object" do
|
115
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"))).
|
116
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should match if uri proc pattern returning true" do
|
120
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true })).
|
121
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should not match if uri proc pattern returns false" do
|
125
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { false })).
|
126
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should match if uri Addressable::Template pattern matches unescaped form of request uri" do
|
130
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com/{any_path}"))).
|
131
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should match if uri Addressable::Template pattern matches request uri" do
|
135
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"))).
|
136
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should match if uri Addressable::Template pattern matches request uri without TLD" do
|
140
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("localhost"))).
|
141
|
+
to match(WebMock::RequestSignature.new(:get, "localhost"))
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should match if Addressable::Template pattern that has ip address host matches request uri" do
|
145
|
+
signature = WebMock::RequestSignature.new(:get, "127.0.0.1:3000/1234")
|
146
|
+
uri = Addressable::Template.new("127.0.0.1:3000/{id}")
|
147
|
+
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should match if Addressable::Template pattern that has ip address host without port matches request uri" do
|
151
|
+
signature = WebMock::RequestSignature.new(:get, "127.0.0.1/1234")
|
152
|
+
uri = Addressable::Template.new("127.0.0.1/{id}")
|
153
|
+
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should match if Addressable::Template pattern host matches request uri" do
|
157
|
+
signature = WebMock::RequestSignature.new(:get, "www.example.com")
|
158
|
+
uri = Addressable::Template.new("{subdomain}.example.com")
|
159
|
+
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should not match if Addressable::Template pattern host does not match request uri" do
|
163
|
+
signature = WebMock::RequestSignature.new(:get, "www.bad-example.com")
|
164
|
+
uri = Addressable::Template.new("{subdomain}.example.com")
|
165
|
+
expect(WebMock::RequestPattern.new(:get, uri)).not_to match(signature)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should match if uri Addressable::Template pattern matches request uri without a schema and a path " do
|
169
|
+
signature = WebMock::RequestSignature.new(:get, "127.0.0.1:3000")
|
170
|
+
uri = Addressable::Template.new("127.0.0.1:3000")
|
171
|
+
expect(WebMock::RequestPattern.new(:get, uri)).to match(signature)
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should match for uris with same parameters as pattern" do
|
175
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2")).
|
176
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should not match for uris with different parameters" do
|
180
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2")).
|
181
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a=2&b=1"))
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should match for uri parameters in different order" do
|
185
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com?b=2&a=1")).
|
186
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "when parameters are escaped" do
|
190
|
+
|
191
|
+
it "should match if uri pattern has escaped parameters and request has unescaped parameters" do
|
192
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com/?a=a%20b")).
|
193
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should match if uri pattern has unescaped parameters and request has escaped parameters" do
|
197
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com/?a=a b")).
|
198
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should match if uri regexp pattern matches uri with unescaped parameters and request has escaped parameters" do
|
202
|
+
expect(WebMock::RequestPattern.new(:get, /.*a=a b.*/)).
|
203
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should match if uri regexp pattern matches uri with escaped parameters and request has unescaped parameters" do
|
207
|
+
expect(WebMock::RequestPattern.new(:get, /.*a=a%20b.*/)).
|
208
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
|
209
|
+
end
|
210
|
+
|
211
|
+
it "should match if uri Addressable::Template pattern matches uri without parameter value and request has escaped parameters" do
|
212
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com/{?a}"))).
|
213
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
|
214
|
+
end
|
215
|
+
|
216
|
+
it "should match if uri Addressable::Template pattern matches uri without parameter value and request has unescaped parameters" do
|
217
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com/{?a}"))).
|
218
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should match if uri Addressable::Template pattern matches uri with unescaped parameter value and request has unescaped parameters" do
|
222
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com/?a=a b"))).
|
223
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should match if uri Addressable::Template pattern matches uri with escaped parameter value and request has escaped parameters" do
|
227
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com/?a=a%20b"))).
|
228
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
describe "when matching requests on query params" do
|
234
|
+
|
235
|
+
describe "when uri is described as regexp" do
|
236
|
+
it "should match request query params" do
|
237
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/, query: {"a" => ["b", "c"]})).
|
238
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should not match request query params if params don't match" do
|
242
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/, query: {"x" => ["b", "c"]})).
|
243
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
247
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
|
248
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
249
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
253
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
|
254
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
255
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
259
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
|
260
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
261
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
265
|
+
expect(WebMock::RequestPattern.new(:get, /.*example.*/,
|
266
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
267
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
describe "when uri is described as URI" do
|
272
|
+
it "should match request query params" do
|
273
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"), query: {"a" => ["b", "c"]})).
|
274
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
275
|
+
end
|
276
|
+
|
277
|
+
it "should not match request query params if params don't match" do
|
278
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"), query: {"x" => ["b", "c"]})).
|
279
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
280
|
+
end
|
281
|
+
|
282
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
283
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
284
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
285
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
289
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
290
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
291
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
295
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
296
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
297
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
301
|
+
expect(WebMock::RequestPattern.new(:get, URI.parse("www.example.com"),
|
302
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
303
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
describe "when uri is described as a proc" do
|
308
|
+
it "should match request query params" do
|
309
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true }, query: {"a" => ["b", "c"]})).
|
310
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should not match request query params if params don't match" do
|
314
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true }, query: {"x" => ["b", "c"]})).
|
315
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
319
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
320
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
321
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
322
|
+
end
|
323
|
+
|
324
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
325
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
326
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
327
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
331
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
332
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
333
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
334
|
+
end
|
335
|
+
|
336
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
337
|
+
expect(WebMock::RequestPattern.new(:get, ->(uri) { true },
|
338
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
339
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
describe "when uri is described as Addressable::Template" do
|
344
|
+
it "should raise error if query params are specified" do
|
345
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"), query: {"a" => ["b", "c"]})).
|
346
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
347
|
+
end
|
348
|
+
|
349
|
+
it "should not match request query params if params don't match" do
|
350
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"), query: {"x" => ["b", "c"]})).
|
351
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
352
|
+
end
|
353
|
+
|
354
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
355
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"),
|
356
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
357
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
358
|
+
end
|
359
|
+
|
360
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
361
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"),
|
362
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
363
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
364
|
+
end
|
365
|
+
|
366
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
367
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"),
|
368
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
369
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
370
|
+
end
|
371
|
+
|
372
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
373
|
+
expect(WebMock::RequestPattern.new(:get, Addressable::Template.new("www.example.com"),
|
374
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
375
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
describe "when uri is described as string" do
|
380
|
+
it "should match when query params are the same as declared in hash" do
|
381
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", query: {"a" => ["b", "c"]})).
|
382
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
383
|
+
end
|
384
|
+
|
385
|
+
it "should not match when query params are different than the declared in hash" do
|
386
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", query: {"a" => ["b", "c"]})).
|
387
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?x[]=b&a[]=c"))
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should match when query params are the same as declared as string" do
|
391
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", query: "a[]=b&a[]=c")).
|
392
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
|
393
|
+
end
|
394
|
+
|
395
|
+
it "should match when query params are the same as declared both in query option or url" do
|
396
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com/?x=3", query: "a[]=b&a[]=c")).
|
397
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com/?x=3&a[]=b&a[]=c"))
|
398
|
+
end
|
399
|
+
|
400
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
401
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com",
|
402
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
403
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
407
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com",
|
408
|
+
query: WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]}))).
|
409
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
410
|
+
end
|
411
|
+
|
412
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
413
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com",
|
414
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]}))).
|
415
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
416
|
+
end
|
417
|
+
|
418
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
419
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com",
|
420
|
+
query: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]}))).
|
421
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
|
422
|
+
end
|
423
|
+
|
424
|
+
context "when using query values notation as flat array" do
|
425
|
+
before :all do
|
426
|
+
WebMock::Config.instance.query_values_notation = :flat_array
|
427
|
+
end
|
428
|
+
|
429
|
+
it "should not match when repeated query params are not the same as declared as string" do
|
430
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", query: "a=b&a=c")).
|
431
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com?a=b&a=c"))
|
432
|
+
end
|
433
|
+
|
434
|
+
after :all do
|
435
|
+
WebMock::Config.instance.query_values_notation = nil
|
436
|
+
end
|
437
|
+
end
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
describe "when matching requests with body" do
|
442
|
+
|
443
|
+
it "should match if request body and body pattern are the same" do
|
444
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: "abc")).
|
445
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "abc"))
|
446
|
+
end
|
447
|
+
|
448
|
+
it "should match if request body matches regexp" do
|
449
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: /^abc$/)).
|
450
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "abc"))
|
451
|
+
end
|
452
|
+
|
453
|
+
it "should not match if body pattern is different than request body" do
|
454
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: "def")).
|
455
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "abc"))
|
456
|
+
end
|
457
|
+
|
458
|
+
it "should not match if request body doesn't match regexp pattern" do
|
459
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: /^abc$/)).
|
460
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "xabc"))
|
461
|
+
end
|
462
|
+
|
463
|
+
it "should match if pattern doesn't have specified body" do
|
464
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com")).
|
465
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "abc"))
|
466
|
+
end
|
467
|
+
|
468
|
+
it "should not match if pattern has body specified as nil but request body is not empty" do
|
469
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: nil)).
|
470
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "abc"))
|
471
|
+
end
|
472
|
+
|
473
|
+
it "should not match if pattern has empty body but request body is not empty" do
|
474
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: "")).
|
475
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", body: "abc"))
|
476
|
+
end
|
477
|
+
|
478
|
+
it "should not match if pattern has body specified but request has no body" do
|
479
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", body: "abc")).
|
480
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
481
|
+
end
|
482
|
+
|
483
|
+
describe "when body in pattern is declared as a hash" do
|
484
|
+
let(:body_hash) { {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}} }
|
485
|
+
|
486
|
+
describe "for request with url encoded body" do
|
487
|
+
it "should match when hash matches body" do
|
488
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
489
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'a=1&c[d][]=e&c[d][]=f&b=five'))
|
490
|
+
end
|
491
|
+
|
492
|
+
it "should match when hash matches body in different order of params" do
|
493
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
494
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'a=1&c[d][]=e&b=five&c[d][]=f'))
|
495
|
+
end
|
496
|
+
|
497
|
+
it "should not match when hash doesn't match url encoded body" do
|
498
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
499
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'c[d][]=f&a=1&c[d][]=e'))
|
500
|
+
end
|
501
|
+
|
502
|
+
it "should not match when body is not url encoded" do
|
503
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
504
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'foo bar'))
|
505
|
+
end
|
506
|
+
|
507
|
+
it "should match when hash contains regex values" do
|
508
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com", body: {a: /^\w{5}$/, b: {c: /^\d{3}$/}})).
|
509
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'a=abcde&b[c]=123'))
|
510
|
+
end
|
511
|
+
|
512
|
+
it "should not match when hash does not contains regex values" do
|
513
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com", body: {a: /^\d+$/, b: {c: /^\d{3}$/}})).
|
514
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'a=abcde&b[c]=123'))
|
515
|
+
end
|
516
|
+
|
517
|
+
context 'body is an hash with an array of hashes' do
|
518
|
+
let(:body_hash) { {a: [{'b' => '1'}, {'b' => '2'}]} }
|
519
|
+
|
520
|
+
it "should match when hash matches body" do
|
521
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
522
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'a[][b]=1&a[][b]=2'))
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
context 'body is an hash with an array of hashes with multiple keys' do
|
527
|
+
let(:body_hash) { {a: [{'b' => '1', 'a' => '2'}, {'b' => '3'}]} }
|
528
|
+
|
529
|
+
it "should match when hash matches body" do
|
530
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
531
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", body: 'a[][b]=1&a[][a]=2&a[][b]=3'))
|
532
|
+
end
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
536
|
+
describe "for request with json body and content type is set to json" do
|
537
|
+
shared_examples "a json body" do
|
538
|
+
it "should match when hash matches body" do
|
539
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
540
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
541
|
+
body: "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}"))
|
542
|
+
end
|
543
|
+
|
544
|
+
it "should match if hash matches body in different form" do
|
545
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
546
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
547
|
+
body: "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}"))
|
548
|
+
end
|
549
|
+
|
550
|
+
it "should not match when body is not json" do
|
551
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
552
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
553
|
+
headers: {content_type: content_type}, body: "foo bar"))
|
554
|
+
end
|
555
|
+
|
556
|
+
it "should not match if request body is different" do
|
557
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1, b: 2})).
|
558
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
559
|
+
headers: {content_type: content_type}, body: "{\"a\":1,\"c\":null}"))
|
560
|
+
end
|
561
|
+
|
562
|
+
it "should not match if request body is has less params than pattern" do
|
563
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1, b: 2})).
|
564
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
565
|
+
headers: {content_type: content_type}, body: "{\"a\":1}"))
|
566
|
+
end
|
567
|
+
|
568
|
+
it "should not match if request body is has more params than pattern" do
|
569
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: {a: 1})).
|
570
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
571
|
+
headers: {content_type: content_type}, body: "{\"a\":1,\"c\":1}"))
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
context "standard application/json" do
|
576
|
+
let(:content_type) { 'application/json' }
|
577
|
+
it_behaves_like "a json body"
|
578
|
+
end
|
579
|
+
|
580
|
+
context "custom json content type" do
|
581
|
+
let(:content_type) { 'application/vnd.api+json' }
|
582
|
+
it_behaves_like "a json body"
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
describe "for request with xml body and content type is set to xml" do
|
587
|
+
let(:body_hash) { {"opt" => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}}} }
|
588
|
+
|
589
|
+
shared_examples "a xml body" do
|
590
|
+
it "should match when hash matches body" do
|
591
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
592
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
593
|
+
body: "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
|
594
|
+
end
|
595
|
+
|
596
|
+
it "should match if hash matches body in different form" do
|
597
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
598
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: content_type},
|
599
|
+
body: "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
|
600
|
+
end
|
601
|
+
|
602
|
+
it "should not match when body is not xml" do
|
603
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
604
|
+
not_to match(WebMock::RequestSignature.new(:post, "www.example.com",
|
605
|
+
headers: {content_type: content_type}, body: "foo bar"))
|
606
|
+
end
|
607
|
+
|
608
|
+
it "matches when the content type include a charset" do
|
609
|
+
expect(WebMock::RequestPattern.new(:post, 'www.example.com', body: body_hash)).
|
610
|
+
to match(WebMock::RequestSignature.new(:post, "www.example.com", headers: {content_type: "#{content_type};charset=UTF-8"},
|
611
|
+
body: "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
|
612
|
+
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
context "standard application/xml" do
|
617
|
+
let(:content_type) { 'application/xml' }
|
618
|
+
it_behaves_like "a xml body"
|
619
|
+
end
|
620
|
+
|
621
|
+
context "custom xml content type" do
|
622
|
+
let(:content_type) { 'application/atom+xml' }
|
623
|
+
it_behaves_like "a xml body"
|
624
|
+
end
|
625
|
+
end
|
626
|
+
end
|
627
|
+
|
628
|
+
describe "when body in a pattern is declared as a partial hash matcher" do
|
629
|
+
let(:signature) { WebMock::RequestSignature.new(:post, "www.example.com", body: 'a=1&c[d][]=e&c[d][]=f&b=five') }
|
630
|
+
|
631
|
+
it "should match when query params are declared as HashIncluding matcher matching params" do
|
632
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com",
|
633
|
+
body: WebMock::Matchers::HashIncludingMatcher.new({:a => '1', 'c' => {'d' => ['e', 'f']}}))).
|
634
|
+
to match(signature)
|
635
|
+
end
|
636
|
+
|
637
|
+
it "should not match when query params are declared as HashIncluding matcher not matching params" do
|
638
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com",
|
639
|
+
body: WebMock::Matchers::HashIncludingMatcher.new({:x => '1', 'c' => {'d' => ['e', 'f']}}))).
|
640
|
+
not_to match(signature)
|
641
|
+
end
|
642
|
+
|
643
|
+
it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
|
644
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com",
|
645
|
+
body: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({:a => '1', 'c' => {'d' => ['e', 'f']}}))).
|
646
|
+
to match(signature)
|
647
|
+
end
|
648
|
+
|
649
|
+
it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
|
650
|
+
expect(WebMock::RequestPattern.new(:post, "www.example.com",
|
651
|
+
body: RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({:x => '1', 'c' => {'d' => ['e', 'f']}}))).
|
652
|
+
not_to match(signature)
|
653
|
+
end
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
it "should match if pattern and request have the same headers" do
|
658
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg'})).
|
659
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg'}))
|
660
|
+
end
|
661
|
+
|
662
|
+
it "should match if pattern headers values are regexps matching request header values" do
|
663
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'Content-Type' => %r{^image/jpeg$}})).
|
664
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg'}))
|
665
|
+
end
|
666
|
+
|
667
|
+
it "should not match if pattern has different value of header than request" do
|
668
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'Content-Type' => 'image/png'})).
|
669
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg'}))
|
670
|
+
end
|
671
|
+
|
672
|
+
it "should not match if pattern header value regexp doesn't match request header value" do
|
673
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'Content-Type' => %r{^image\/jpeg$}})).
|
674
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpegx'}))
|
675
|
+
end
|
676
|
+
|
677
|
+
it "should match if request has more headers than request pattern" do
|
678
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg'})).
|
679
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}))
|
680
|
+
end
|
681
|
+
|
682
|
+
it "should not match if request has less headers than the request pattern" do
|
683
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'})).
|
684
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'Content-Type' => 'image/jpeg'}))
|
685
|
+
end
|
686
|
+
|
687
|
+
it "should match even is header keys are declared in different form" do
|
688
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'ContentLength' => '8888', 'Content-type' => 'image/png'})).
|
689
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {:ContentLength => 8888, 'content_type' => 'image/png'}))
|
690
|
+
end
|
691
|
+
|
692
|
+
it "should match is pattern doesn't have specified headers" do
|
693
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com")).
|
694
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'A' => 'a'}))
|
695
|
+
end
|
696
|
+
|
697
|
+
it "should not match if pattern has nil headers but request has headers" do
|
698
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: nil)).
|
699
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'A' => 'a'}))
|
700
|
+
end
|
701
|
+
|
702
|
+
it "should not match if pattern has empty headers but request has headers" do
|
703
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {})).
|
704
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {'A' => 'a'}))
|
705
|
+
end
|
706
|
+
|
707
|
+
it "should not match if pattern has specified headers but request has nil headers" do
|
708
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'A'=>'a'})).
|
709
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
710
|
+
end
|
711
|
+
|
712
|
+
it "should not match if pattern has specified headers but request has empty headers" do
|
713
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com", headers: {'A'=>'a'})).
|
714
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com", headers: {}))
|
715
|
+
end
|
716
|
+
|
717
|
+
it "should match if block given in pattern evaluates request to true" do
|
718
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com").with { |request| true }).
|
719
|
+
to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
720
|
+
end
|
721
|
+
|
722
|
+
it "should not match if block given in pattrn evaluates request to false" do
|
723
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com").with { |request| false }).
|
724
|
+
not_to match(WebMock::RequestSignature.new(:get, "www.example.com"))
|
725
|
+
end
|
726
|
+
|
727
|
+
it "should yield block with request signature" do
|
728
|
+
signature = WebMock::RequestSignature.new(:get, "www.example.com")
|
729
|
+
expect(WebMock::RequestPattern.new(:get, "www.example.com").with { |request| request == signature }).
|
730
|
+
to match(signature)
|
731
|
+
end
|
732
|
+
|
733
|
+
end
|
734
|
+
|
735
|
+
|
736
|
+
end
|