simple-client 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.bundle/config +4 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +23 -0
- data/bin/rake +16 -0
- data/lib/simple-client/simple-client.rb +229 -0
- data/lib/simple-client/version.rb +4 -0
- data/lib/simple-client.rb +1 -0
- data/test/test_simple-client.rb +236 -0
- data/vendor/bundle/ruby/1.8/bin/rake +19 -0
- data/vendor/bundle/ruby/1.8/cache/addressable-2.2.8.gem +0 -0
- data/vendor/bundle/ruby/1.8/cache/crack-0.3.1.gem +0 -0
- data/vendor/bundle/ruby/1.8/cache/rake-0.9.2.2.gem +0 -0
- data/vendor/bundle/ruby/1.8/cache/webmock-1.8.8.gem +0 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/CHANGELOG.md +126 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Gemfile +17 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Gemfile.lock +35 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/README.md +83 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Rakefile +37 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna/native.rb +43 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna/pure.rb +4886 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/template.rb +1047 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/uri.rb +2288 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/version.rb +30 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/idna_spec.rb +216 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/net_http_compat_spec.rb +26 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/template_spec.rb +2144 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/uri_spec.rb +4928 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/clobber.rake +2 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/gem.rake +85 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/git.rake +45 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/metrics.rake +22 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/rspec.rake +58 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/rubyforge.rake +89 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/yard.rake +27 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/website/index.html +110 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/History +25 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/LICENSE +20 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/README.rdoc +42 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/Rakefile +32 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/crack.gemspec +53 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/json.rb +79 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/util.rb +17 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/xml.rb +232 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/crack_test.rb +4 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/data/twittersearch-firefox.json +1 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/data/twittersearch-ie.json +1 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/hash_test.rb +28 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/json_test.rb +82 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/parser_test.rb +27 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/string_test.rb +31 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/test_helper.rb +12 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/xml_test.rb +499 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/CHANGES +522 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/README.rdoc +197 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/Rakefile +369 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/TODO +20 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/bin/rake +33 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/command_line_usage.rdoc +114 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/glossary.rdoc +51 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/jamis.rb +591 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rake.1.gz +0 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rakefile.rdoc +557 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/install.rb +90 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/alt_system.rb +109 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb +595 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/classic_namespace.rb +11 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/clean.rb +32 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/cloneable.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/ftptools.rb +150 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/publisher.rb +73 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/rubyforgepublisher.rb +16 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sys.rb +191 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/default_loader.rb +10 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb +176 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/early_time.rb +18 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/core.rb +27 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb +39 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/string.rb +167 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/time.rb +14 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_list.rb +403 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_task.rb +47 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_utils.rb +114 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb +145 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/gempackagetask.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/invocation_chain.rb +51 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/loaders/makefile.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/multi_task.rb +16 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/name_space.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/packagetask.rb +185 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/pathmap.rb +1 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/pseudo_status.rb +24 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb +29 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb +234 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ruby182_test_unit_fix.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/runtest.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb +327 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_arguments.rb +78 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_manager.rb +307 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/tasklib.rb +22 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/testtask.rb +191 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/version.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/win32.rb +55 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake.rb +69 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/helper.rb +492 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_application.rb +489 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_application_options.rb +335 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_clean.rb +14 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_definitions.rb +80 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_directory_task.rb +46 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_dsl.rb +77 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_extension.rb +59 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_list.rb +628 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_list_path_map.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_task.rb +102 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_utils.rb +305 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb +59 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_functional.rb +450 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_invocation_chain.rb +52 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_makefile_loader.rb +44 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_multi_task.rb +51 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_name_space.rb +43 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map.rb +157 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rake_test_loader.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rdoc_task.rb +83 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rules.rb +327 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task.rb +267 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_argument_parsing.rb +103 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_arguments.rb +88 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_lib.rb +9 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_manager.rb +157 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_manager_argument_resolution.rb +36 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_with_arguments.rb +173 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_test_task.rb +120 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_top_level_functions.rb +111 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_sys.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/CHANGELOG.md +749 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Gemfile +21 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Guardfile +24 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/LICENSE +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/README.md +728 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Rakefile +65 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/api.rb +63 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/assertion_failure.rb +11 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/callback_registry.rb +35 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/config.rb +10 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/cucumber.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/deprecation.rb +9 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/errors.rb +33 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/curb_adapter.rb +287 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request/em_http_request_0_x.rb +151 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb +212 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +11 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/excon_adapter.rb +95 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/httpclient_adapter.rb +193 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/net_http.rb +279 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/patron_adapter.rb +129 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +180 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/matchers/hash_including_matcher.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/minitest.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rack_response.rb +63 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_execution_verifier.rb +56 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_pattern.rb +282 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_registry.rb +35 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_signature.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_stub.rb +97 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/response.rb +144 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/responses_sequence.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers/request_pattern_matcher.rb +42 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers/webmock_matcher.rb +46 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers.rb +28 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec.rb +33 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/stub_registry.rb +61 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/stub_request_snippet.rb +30 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/test_unit.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/hash_counter.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/hash_keys_stringifier.rb +23 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/headers.rb +43 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/json.rb +54 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/uri.rb +101 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/version_checker.rb +73 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/version.rb +3 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/webmock.rb +124 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock.rb +49 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/test_helper.rb +29 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/test_webmock.rb +6 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/webmock_spec.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/curb/curb_spec.rb +340 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/curb/curb_spec_helper.rb +144 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/em_http_request/em_http_request_spec.rb +183 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +72 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/excon/excon_spec.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/excon/excon_spec_helper.rb +38 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/httpclient/httpclient_spec.rb +76 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/httpclient/httpclient_spec_helper.rb +48 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_shared.rb +125 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec.rb +255 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec_helper.rb +55 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/patron/patron_spec.rb +136 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/patron/patron_spec_helper.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +142 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/callbacks.rb +146 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/request_expectations.rb +666 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/returning_declared_responses.rb +367 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/stubbing_requests.rb +447 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +74 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +56 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/webmock_shared.rb +41 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/quality_spec.rb +60 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/spec_helper.rb +57 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/example_curl_output.txt +22 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/my_rack_app.rb +48 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/network_connection.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/webmock_server.rb +65 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/errors_spec.rb +32 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/rack_response_spec.rb +74 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_execution_verifier_spec.rb +100 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_pattern_spec.rb +479 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_registry_spec.rb +75 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_signature_spec.rb +113 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_stub_spec.rb +198 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/response_spec.rb +267 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/stub_registry_spec.rb +86 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/stub_request_snippet_spec.rb +95 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/hash_counter_spec.rb +39 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/headers_spec.rb +28 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/json_spec.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/uri_spec.rb +257 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/version_checker_spec.rb +59 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/webmock_spec.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/http_request.rb +24 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/shared_test.rb +76 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/test_helper.rb +23 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/test_webmock.rb +6 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/webmock.gemspec +35 -0
- data/vendor/bundle/ruby/1.8/specifications/addressable-2.2.8.gemspec +38 -0
- data/vendor/bundle/ruby/1.8/specifications/crack-0.3.1.gemspec +25 -0
- data/vendor/bundle/ruby/1.8/specifications/rake-0.9.2.2.gemspec +33 -0
- data/vendor/bundle/ruby/1.8/specifications/webmock-1.8.8.gemspec +61 -0
- metadata +390 -0
@@ -0,0 +1,255 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ostruct'
|
3
|
+
require 'acceptance/webmock_shared'
|
4
|
+
require 'acceptance/net_http/net_http_spec_helper'
|
5
|
+
require 'acceptance/net_http/net_http_shared'
|
6
|
+
|
7
|
+
include NetHTTPSpecHelper
|
8
|
+
|
9
|
+
describe "Net:HTTP" do
|
10
|
+
include_examples "with WebMock"
|
11
|
+
|
12
|
+
let(:port){ WebMockServer.instance.port }
|
13
|
+
|
14
|
+
describe "marshalling" do
|
15
|
+
class TestMarshalingInWebMockNetHTTP
|
16
|
+
attr_accessor :r
|
17
|
+
end
|
18
|
+
before(:each) do
|
19
|
+
@b = TestMarshalingInWebMockNetHTTP.new
|
20
|
+
end
|
21
|
+
after(:each) do
|
22
|
+
WebMock.enable!
|
23
|
+
end
|
24
|
+
it "should be possible to load object marshalled when webmock was disabled" do
|
25
|
+
WebMock.disable!
|
26
|
+
original_constants = [
|
27
|
+
Net::HTTP::Get,
|
28
|
+
Net::HTTP::Post,
|
29
|
+
Net::HTTP::Put,
|
30
|
+
Net::HTTP::Delete,
|
31
|
+
Net::HTTP::Head,
|
32
|
+
Net::HTTP::Options
|
33
|
+
]
|
34
|
+
@b.r = original_constants
|
35
|
+
original_serialized = Marshal.dump(@b)
|
36
|
+
Marshal.load(original_serialized)
|
37
|
+
WebMock.enable!
|
38
|
+
Marshal.load(original_serialized)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be possible to load object marshalled when webmock was enabled" do
|
42
|
+
WebMock.enable!
|
43
|
+
new_constants = [
|
44
|
+
Net::HTTP::Get,
|
45
|
+
Net::HTTP::Post,
|
46
|
+
Net::HTTP::Put,
|
47
|
+
Net::HTTP::Delete,
|
48
|
+
Net::HTTP::Head,
|
49
|
+
Net::HTTP::Options
|
50
|
+
]
|
51
|
+
@b.r = new_constants
|
52
|
+
new_serialized = Marshal.dump(@b)
|
53
|
+
Marshal.load(new_serialized)
|
54
|
+
WebMock.disable!
|
55
|
+
Marshal.load(new_serialized)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "constants" do
|
60
|
+
it "should still have const Get defined on replaced Net::HTTP" do
|
61
|
+
Object.const_get("Net").const_get("HTTP").const_defined?("Get").should be_true
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should still have const Get within constants on replaced Net::HTTP" do
|
65
|
+
Object.const_get("Net").const_get("HTTP").constants.map(&:to_s).should include("Get")
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should still have const Get within constants on replaced Net::HTTP" do
|
69
|
+
Object.const_get("Net").const_get("HTTP").const_get("Get").should_not be_nil
|
70
|
+
end
|
71
|
+
|
72
|
+
if Module.method(:const_defined?).arity != 1
|
73
|
+
it "should still have const Get defined (and not inherited) on replaced Net::HTTP" do
|
74
|
+
Object.const_get("Net").const_get("HTTP").const_defined?("Get", false).should be_true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if Module.method(:const_get).arity != 1
|
79
|
+
it "should still be able to get non inherited constant Get on replaced Net::HTTP" do
|
80
|
+
Object.const_get("Net").const_get("HTTP").const_get("Get", false).should_not be_nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if Module.method(:constants).arity != 0
|
85
|
+
it "should still Get within non inherited constants on replaced Net::HTTP" do
|
86
|
+
Object.const_get("Net").const_get("HTTP").constants(false).map(&:to_s).should include("Get")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should work with block provided" do
|
92
|
+
stub_http_request(:get, "www.example.com").to_return(:body => "abc"*100000)
|
93
|
+
Net::HTTP.start("www.example.com") { |query| query.get("/") }.body.should == "abc"*100000
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should handle multiple values for the same response header" do
|
97
|
+
stub_http_request(:get, "www.example.com").to_return(:headers => { 'Set-Cookie' => ['foo=bar', 'bar=bazz'] })
|
98
|
+
response = Net::HTTP.get_response(URI.parse("http://www.example.com/"))
|
99
|
+
response.get_fields('Set-Cookie').should == ['bar=bazz', 'foo=bar']
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should yield block on response" do
|
103
|
+
stub_http_request(:get, "www.example.com").to_return(:body => "abc")
|
104
|
+
response_body = ""
|
105
|
+
http_request(:get, "http://www.example.com/") do |response|
|
106
|
+
response_body = response.body
|
107
|
+
end
|
108
|
+
response_body.should == "abc"
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should handle Net::HTTP::Post#body" do
|
112
|
+
stub_http_request(:post, "www.example.com").with(:body => "my_params").to_return(:body => "abc")
|
113
|
+
req = Net::HTTP::Post.new("/")
|
114
|
+
req.body = "my_params"
|
115
|
+
Net::HTTP.start("www.example.com") { |http| http.request(req)}.body.should == "abc"
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should handle Net::HTTP::Post#body_stream" do
|
119
|
+
stub_http_request(:post, "www.example.com").with(:body => "my_params").to_return(:body => "abc")
|
120
|
+
req = Net::HTTP::Post.new("/")
|
121
|
+
req.body_stream = StringIO.new("my_params")
|
122
|
+
Net::HTTP.start("www.example.com") { |http| http.request(req)}.body.should == "abc"
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should behave like Net::HTTP and raise error if both request body and body argument are set" do
|
126
|
+
stub_http_request(:post, "www.example.com").with(:body => "my_params").to_return(:body => "abc")
|
127
|
+
req = Net::HTTP::Post.new("/")
|
128
|
+
req.body = "my_params"
|
129
|
+
lambda {
|
130
|
+
Net::HTTP.start("www.example.com") { |http| http.request(req, "my_params")}
|
131
|
+
}.should raise_error("both of body argument and HTTPRequest#body set")
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should return a Net::ReadAdapter from response.body when a stubbed request is made with a block and #read_body" do
|
135
|
+
WebMock.stub_request(:get, 'http://example.com/').to_return(:body => "the body")
|
136
|
+
response = Net::HTTP.new('example.com', 80).request_get('/') { |r| r.read_body { } }
|
137
|
+
response.body.should be_a(Net::ReadAdapter)
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should have request 1 time executed in registry after 1 real request", :net_connect => true do
|
141
|
+
WebMock.allow_net_connect!
|
142
|
+
http = Net::HTTP.new('localhost', port)
|
143
|
+
http.get('/') {}
|
144
|
+
WebMock::RequestRegistry.instance.requested_signatures.hash.size.should == 1
|
145
|
+
WebMock::RequestRegistry.instance.requested_signatures.hash.values.first.should == 1
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "connecting on Net::HTTP.start" do
|
149
|
+
before(:each) do
|
150
|
+
@http = Net::HTTP.new('www.google.com', 443)
|
151
|
+
@http.use_ssl = true
|
152
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
153
|
+
end
|
154
|
+
describe "when net http is allowed" do
|
155
|
+
it "should not connect to the server until the request", :net_connect => true do
|
156
|
+
WebMock.allow_net_connect!
|
157
|
+
@http.start {|conn|
|
158
|
+
conn.peer_cert.should be_nil
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should connect to the server on start", :net_connect => true do
|
163
|
+
WebMock.allow_net_connect!(:net_http_connect_on_start => true)
|
164
|
+
@http.start {|conn|
|
165
|
+
cert = OpenSSL::X509::Certificate.new conn.peer_cert
|
166
|
+
cert.should be_a(OpenSSL::X509::Certificate)
|
167
|
+
}
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "when net http is disabled and allowed only for some hosts" do
|
173
|
+
it "should not connect to the server until the request", :net_connect => true do
|
174
|
+
WebMock.disable_net_connect!(:allow => "www.google.com")
|
175
|
+
@http.start {|conn|
|
176
|
+
conn.peer_cert.should be_nil
|
177
|
+
}
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should connect to the server on start", :net_connect => true do
|
181
|
+
WebMock.disable_net_connect!(:allow => "www.google.com", :net_http_connect_on_start => true)
|
182
|
+
@http.start {|conn|
|
183
|
+
cert = OpenSSL::X509::Certificate.new conn.peer_cert
|
184
|
+
cert.should be_a(OpenSSL::X509::Certificate)
|
185
|
+
}
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should connect to the server if the URI matches an regex", :net_connect => true do
|
189
|
+
WebMock.disable_net_connect!(:allow => /google.com/)
|
190
|
+
response = Net::HTTP.get('www.google.com','/')
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
describe "when net_http_connect_on_start is true" do
|
198
|
+
before(:each) do
|
199
|
+
WebMock.allow_net_connect!(:net_http_connect_on_start => true)
|
200
|
+
end
|
201
|
+
it_should_behave_like "Net::HTTP"
|
202
|
+
end
|
203
|
+
|
204
|
+
describe "when net_http_connect_on_start is false" do
|
205
|
+
before(:each) do
|
206
|
+
WebMock.allow_net_connect!(:net_http_connect_on_start => false)
|
207
|
+
end
|
208
|
+
it_should_behave_like "Net::HTTP"
|
209
|
+
end
|
210
|
+
|
211
|
+
describe 'after_request callback support', :net_connect => true do
|
212
|
+
let(:expected_body_regex) { /hello world/ }
|
213
|
+
|
214
|
+
before(:each) do
|
215
|
+
WebMock.allow_net_connect!
|
216
|
+
@callback_invocation_count = 0
|
217
|
+
WebMock.after_request do |_, response|
|
218
|
+
@callback_invocation_count += 1
|
219
|
+
@callback_response = response
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
after(:each) do
|
224
|
+
WebMock.reset_callbacks
|
225
|
+
end
|
226
|
+
|
227
|
+
def perform_get_with_returning_block
|
228
|
+
http_request(:get, "http://localhost:#{port}/") do |response|
|
229
|
+
return response.body
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should support the after_request callback on an request with block and read_body" do
|
234
|
+
response_body = ''
|
235
|
+
http_request(:get, "http://localhost:#{port}/") do |response|
|
236
|
+
response.read_body { |fragment| response_body << fragment }
|
237
|
+
end
|
238
|
+
response_body.should =~ expected_body_regex
|
239
|
+
|
240
|
+
@callback_response.body.should == response_body
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should support the after_request callback on a request with a returning block" do
|
244
|
+
response_body = perform_get_with_returning_block
|
245
|
+
response_body.should =~ expected_body_regex
|
246
|
+
@callback_response.should be_instance_of(WebMock::Response)
|
247
|
+
@callback_response.body.should == response_body
|
248
|
+
end
|
249
|
+
|
250
|
+
it "should only invoke the after_request callback once, even for a recursive post request" do
|
251
|
+
Net::HTTP.new('localhost', port).post('/', nil)
|
252
|
+
@callback_invocation_count.should == 1
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec_helper.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module NetHTTPSpecHelper
|
2
|
+
def http_request(method, uri, options = {}, &block)
|
3
|
+
begin
|
4
|
+
uri = URI.parse(uri)
|
5
|
+
rescue
|
6
|
+
uri = Addressable::URI.heuristic_parse(uri)
|
7
|
+
end
|
8
|
+
response = nil
|
9
|
+
clazz = Net::HTTP.const_get("#{method.to_s.capitalize}")
|
10
|
+
req = clazz.new("#{uri.path}#{uri.query ? '?' : ''}#{uri.query}", nil)
|
11
|
+
options[:headers].each do |k,v|
|
12
|
+
if v.is_a?(Array)
|
13
|
+
v.each_with_index do |v,i|
|
14
|
+
i == 0 ? (req[k] = v) : req.add_field(k, v)
|
15
|
+
end
|
16
|
+
else
|
17
|
+
req[k] = v
|
18
|
+
end
|
19
|
+
end if options[:headers]
|
20
|
+
|
21
|
+
req.basic_auth uri.user, uri.password if uri.user
|
22
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
23
|
+
if uri.scheme == "https"
|
24
|
+
http.use_ssl = true
|
25
|
+
#1.9.1 has a bug with ssl_timeout
|
26
|
+
http.ssl_timeout = 20 unless RUBY_PLATFORM =~ /java/
|
27
|
+
http.open_timeout = 60
|
28
|
+
http.read_timeout = 60
|
29
|
+
end
|
30
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
31
|
+
response = http.start {|http|
|
32
|
+
http.request(req, options[:body], &block)
|
33
|
+
}
|
34
|
+
headers = {}
|
35
|
+
response.each_header {|name, value| headers[name] = value}
|
36
|
+
OpenStruct.new({
|
37
|
+
:body => response.body,
|
38
|
+
:headers => WebMock::Util::Headers.normalize_headers(headers),
|
39
|
+
:status => response.code,
|
40
|
+
:message => response.message
|
41
|
+
})
|
42
|
+
end
|
43
|
+
|
44
|
+
def client_timeout_exception_class
|
45
|
+
Timeout::Error
|
46
|
+
end
|
47
|
+
|
48
|
+
def connection_refused_exception_class
|
49
|
+
Errno::ECONNREFUSED
|
50
|
+
end
|
51
|
+
|
52
|
+
def http_library
|
53
|
+
:net_http
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
require 'net/http'
|
4
|
+
require 'net/https'
|
5
|
+
require 'stringio'
|
6
|
+
require 'acceptance/net_http/net_http_shared'
|
7
|
+
require 'support/webmock_server'
|
8
|
+
|
9
|
+
describe "Real Net:HTTP without webmock", :without_webmock => true do
|
10
|
+
before(:all) do
|
11
|
+
raise "WebMock has no access here!!!" if defined?(WebMock::NetHTTPUtility)
|
12
|
+
WebMockServer.instance.start
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:all) do
|
16
|
+
WebMockServer.instance.stop
|
17
|
+
end
|
18
|
+
|
19
|
+
it_should_behave_like "Net::HTTP"
|
20
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'acceptance/webmock_shared'
|
5
|
+
|
6
|
+
unless RUBY_PLATFORM =~ /java/
|
7
|
+
require 'acceptance/patron/patron_spec_helper'
|
8
|
+
require 'tmpdir'
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
describe "Patron" do
|
12
|
+
include PatronSpecHelper
|
13
|
+
|
14
|
+
include_examples "with WebMock"
|
15
|
+
|
16
|
+
describe "when custom functionality is used" do
|
17
|
+
before(:each) do
|
18
|
+
@sess = Patron::Session.new
|
19
|
+
@sess.base_url = "http://www.example.com"
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "file requests" do
|
23
|
+
|
24
|
+
before(:each) do
|
25
|
+
@dir_path = Dir.mktmpdir('webmock-')
|
26
|
+
@file_path = File.join(@dir_path, "webmock_temp_test_file")
|
27
|
+
FileUtils.rm_rf(@file_path) if File.exists?(@file_path)
|
28
|
+
end
|
29
|
+
|
30
|
+
after(:each) do
|
31
|
+
FileUtils.rm_rf(@dir_path) if File.exist?(@dir_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
it "should work with get_file" do
|
36
|
+
stub_request(:get, "www.example.com").to_return(:body => "abc")
|
37
|
+
@sess.get_file("/", @file_path)
|
38
|
+
File.read(@file_path).should == "abc"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should raise same error as Patron if file is not readable for get request" do
|
42
|
+
stub_request(:get, "www.example.com")
|
43
|
+
File.open("/tmp/read_only_file", "w") do |tmpfile|
|
44
|
+
tmpfile.chmod(0400)
|
45
|
+
end
|
46
|
+
begin
|
47
|
+
lambda {
|
48
|
+
@sess.get_file("/", "/tmp/read_only_file")
|
49
|
+
}.should raise_error(ArgumentError, "Unable to open specified file.")
|
50
|
+
ensure
|
51
|
+
File.unlink("/tmp/read_only_file")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should work with put_file" do
|
56
|
+
File.open(@file_path, "w") {|f| f.write "abc"}
|
57
|
+
stub_request(:put, "www.example.com").with(:body => "abc")
|
58
|
+
@sess.put_file("/", @file_path)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should work with post_file" do
|
62
|
+
File.open(@file_path, "w") {|f| f.write "abc"}
|
63
|
+
stub_request(:post, "www.example.com").with(:body => "abc")
|
64
|
+
@sess.post_file("/", @file_path)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should raise same error as Patron if file is not readable for post request" do
|
68
|
+
stub_request(:post, "www.example.com").with(:body => "abc")
|
69
|
+
lambda {
|
70
|
+
@sess.post_file("/", "/path/to/non/existing/file")
|
71
|
+
}.should raise_error(ArgumentError, "Unable to open specified file.")
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
describe "handling errors same way as patron" do
|
77
|
+
it "should raise error if put request has neither upload_data nor file_name" do
|
78
|
+
stub_request(:post, "www.example.com")
|
79
|
+
lambda {
|
80
|
+
@sess.post("/", nil)
|
81
|
+
}.should raise_error(ArgumentError, "Must provide either data or a filename when doing a PUT or POST")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should work with WebDAV copy request" do
|
86
|
+
stub_request(:copy, "www.example.com/abc").with(:headers => {'Destination' => "/def"})
|
87
|
+
@sess.copy("/abc", "/def")
|
88
|
+
end
|
89
|
+
|
90
|
+
if /^1\.9/ === RUBY_VERSION
|
91
|
+
describe "handling encoding same way as patron" do
|
92
|
+
around(:each) do |example|
|
93
|
+
@encoding = Encoding.default_internal
|
94
|
+
Encoding.default_internal = "UTF-8"
|
95
|
+
example.run
|
96
|
+
Encoding.default_internal = @encoding
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should encode body with default encoding" do
|
100
|
+
stub_request(:get, "www.example.com").
|
101
|
+
to_return(:body => "Øl")
|
102
|
+
|
103
|
+
@sess.get("").body.encoding.should == Encoding::UTF_8
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should encode body to default internal" do
|
107
|
+
stub_request(:get, "www.example.com").
|
108
|
+
to_return(:headers => {'Content-Type' => 'text/html; charset=iso-8859-1'},
|
109
|
+
:body => "Øl".encode("iso-8859-1"))
|
110
|
+
|
111
|
+
@sess.get("").body.encoding.should == Encoding.default_internal
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should encode body based on encoding-attribute in body" do
|
115
|
+
stub_request(:get, "www.example.com").
|
116
|
+
to_return(:body => "<?xml encoding=\"iso-8859-1\">Øl</xml>".encode("iso-8859-1"))
|
117
|
+
|
118
|
+
|
119
|
+
@sess.get("").body.encoding.should == Encoding::ISO_8859_1
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
it "should encode body based on Session#default_response_charset" do
|
124
|
+
stub_request(:get, "www.example.com").
|
125
|
+
to_return(:body => "Øl".encode("iso-8859-1"))
|
126
|
+
|
127
|
+
@sess.default_response_charset = "iso-8859-1"
|
128
|
+
|
129
|
+
@sess.get("").body.encoding.should == Encoding::ISO_8859_1
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module PatronSpecHelper
|
4
|
+
def http_request(method, uri, options = {}, &block)
|
5
|
+
uri = Addressable::URI.heuristic_parse(uri)
|
6
|
+
sess = Patron::Session.new
|
7
|
+
sess.base_url = "#{uri.omit(:userinfo, :path, :query).normalize.to_s}".gsub(/\/$/,"")
|
8
|
+
sess.username = uri.user
|
9
|
+
sess.password = uri.password
|
10
|
+
|
11
|
+
sess.connect_timeout = 30
|
12
|
+
sess.timeout = 30
|
13
|
+
sess.max_redirects = 0
|
14
|
+
uri = "#{uri.path}#{uri.query ? '?' : ''}#{uri.query}"
|
15
|
+
uri.gsub!(' ','+')
|
16
|
+
response = sess.request(method, uri, options[:headers] || {}, {
|
17
|
+
:data => options[:body]
|
18
|
+
})
|
19
|
+
headers = {}
|
20
|
+
if response.headers
|
21
|
+
response.headers.each do |k,v|
|
22
|
+
v = v.join(", ") if v.is_a?(Array)
|
23
|
+
headers[k] = v
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
status_line_pattern = %r(\AHTTP/(\d+\.\d+)\s+(\d\d\d)\s*([^\r\n]+)?)
|
28
|
+
message = response.status_line.match(status_line_pattern)[3] || ""
|
29
|
+
|
30
|
+
OpenStruct.new({
|
31
|
+
:body => response.body,
|
32
|
+
:headers => WebMock::Util::Headers.normalize_headers(headers),
|
33
|
+
:status => response.status.to_s,
|
34
|
+
:message => message
|
35
|
+
})
|
36
|
+
end
|
37
|
+
|
38
|
+
def client_timeout_exception_class
|
39
|
+
Patron::TimeoutError
|
40
|
+
end
|
41
|
+
|
42
|
+
def connection_refused_exception_class
|
43
|
+
Patron::ConnectionFailed
|
44
|
+
end
|
45
|
+
|
46
|
+
def http_library
|
47
|
+
:patron
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
shared_context "allowing and disabling net connect" do |*adapter_info|
|
2
|
+
describe "when net connect" do
|
3
|
+
describe "is allowed", :net_connect => true do
|
4
|
+
before(:each) do
|
5
|
+
WebMock.allow_net_connect!
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should make a real web request if request is not stubbed" do
|
9
|
+
http_request(:get, webmock_server_url).status.should == "200"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should make a real https request if request is not stubbed" do
|
13
|
+
unless http_library == :httpclient
|
14
|
+
http_request(:get, "https://www.google.com/").
|
15
|
+
body.should =~ /.*google.*/
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should return stubbed response if request was stubbed" do
|
20
|
+
stub_request(:get, "www.example.com").to_return(:body => "abc")
|
21
|
+
http_request(:get, "http://www.example.com/").body.should == "abc"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "is not allowed" do
|
26
|
+
before(:each) do
|
27
|
+
WebMock.disable_net_connect!
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return stubbed response if request was stubbed" do
|
31
|
+
stub_request(:get, "www.example.com").to_return(:body => "abc")
|
32
|
+
http_request(:get, "http://www.example.com/").body.should == "abc"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should return stubbed response if request with path was stubbed" do
|
36
|
+
stub_request(:get, "www.example.com/hello_world").to_return(:body => "abc")
|
37
|
+
http_request(:get, "http://www.example.com/hello_world").body.should == "abc"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should raise exception if request was not stubbed" do
|
41
|
+
lambda {
|
42
|
+
http_request(:get, "http://www.example.com/")
|
43
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "is not allowed with exception for localhost" do
|
48
|
+
before(:each) do
|
49
|
+
WebMock.disable_net_connect!(:allow_localhost => true)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return stubbed response if request was stubbed" do
|
53
|
+
stub_request(:get, "www.example.com").to_return(:body => "abc")
|
54
|
+
http_request(:get, "http://www.example.com/").body.should == "abc"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should raise exception if request was not stubbed" do
|
58
|
+
lambda {
|
59
|
+
http_request(:get, "http://www.example.com/")
|
60
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should make a real request to localhost" do
|
64
|
+
lambda {
|
65
|
+
http_request(:get, "http://localhost:12345/")
|
66
|
+
}.should raise_error(connection_refused_exception_class)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should make a real request to 127.0.0.1" do
|
70
|
+
lambda {
|
71
|
+
http_request(:get, "http://127.0.0.1:12345/")
|
72
|
+
}.should raise_error(connection_refused_exception_class)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should make a real request to 0.0.0.0" do
|
76
|
+
lambda {
|
77
|
+
http_request(:get, "http://0.0.0.0:12345/")
|
78
|
+
}.should raise_error(connection_refused_exception_class)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "is not allowed with exception for allowed domains" do
|
83
|
+
let(:host_with_port){ WebMockServer.instance.host_with_port }
|
84
|
+
|
85
|
+
before(:each) do
|
86
|
+
WebMock.disable_net_connect!(:allow => ["www.example.org", host_with_port])
|
87
|
+
end
|
88
|
+
|
89
|
+
context "when the host is not allowed" do
|
90
|
+
it "should return stubbed response if request was stubbed" do
|
91
|
+
stub_request(:get, "www.example.com").to_return(:body => "abc")
|
92
|
+
http_request(:get, "http://www.example.com/").body.should == "abc"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should raise exception if request was not stubbed" do
|
96
|
+
lambda {
|
97
|
+
http_request(:get, "http://www.example.com/")
|
98
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "when the host with port is not allowed" do
|
103
|
+
it "should return stubbed response if request was stubbed" do
|
104
|
+
stub_request(:get, "http://localhost:2345").to_return(:body => "abc")
|
105
|
+
http_request(:get, "http://localhost:2345/").body.should == "abc"
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should raise exception if request was not stubbed" do
|
109
|
+
lambda {
|
110
|
+
http_request(:get, "http://localhost:2345/")
|
111
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://localhost:2345/))
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "when the host is allowed" do
|
116
|
+
it "should raise exception if request was not stubbed" do
|
117
|
+
lambda {
|
118
|
+
http_request(:get, "http://www.example.com/")
|
119
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should make a real request to allowed host", :net_connect => true do
|
123
|
+
http_request(:get, "http://www.example.org/").status.should == "302"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "when the host with port is allowed" do
|
128
|
+
it "should make a real request to allowed host", :net_connect => true do
|
129
|
+
http_request(:get, "http://#{host_with_port}/").status.should == "200"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "when the host is allowed but not port" do
|
134
|
+
it "should make a real request to allowed host", :net_connect => true do
|
135
|
+
lambda {
|
136
|
+
http_request(:get, "http://localhost:123/")
|
137
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://localhost:123/))
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|