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,447 @@
|
|
1
|
+
shared_examples_for "stubbing requests" do |*adapter_info|
|
2
|
+
describe "when requests are stubbed" do
|
3
|
+
describe "based on uri" do
|
4
|
+
it "should return stubbed response even if request have escaped parameters" do
|
5
|
+
stub_request(:get, "www.example.com/hello/?#{NOT_ESCAPED_PARAMS}").to_return(:body => "abc")
|
6
|
+
http_request(:get, "http://www.example.com/hello/?#{ESCAPED_PARAMS}").body.should == "abc"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should return stubbed response even if request has non escaped params" do
|
10
|
+
stub_request(:get, "www.example.com/hello/?#{ESCAPED_PARAMS}").to_return(:body => "abc")
|
11
|
+
http_request(:get, "http://www.example.com/hello/?#{NOT_ESCAPED_PARAMS}").body.should == "abc"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return stubbed response even if stub uri is declared as regexp and request params are escaped" do
|
15
|
+
stub_request(:get, /.*x=ab c.*/).to_return(:body => "abc")
|
16
|
+
http_request(:get, "http://www.example.com/hello/?#{ESCAPED_PARAMS}").body.should == "abc"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "based on query params" do
|
21
|
+
it "should return stubbed response when stub declares query params as a hash" do
|
22
|
+
stub_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).to_return(:body => "abc")
|
23
|
+
http_request(:get, "http://www.example.com/?a[]=b&a[]=c").body.should == "abc"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return stubbed response when stub declares query params as a hash" do
|
27
|
+
stub_request(:get, "www.example.com").with(:query => "a[]=b&a[]=c").to_return(:body => "abc")
|
28
|
+
http_request(:get, "http://www.example.com/?a[]=b&a[]=c").body.should == "abc"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return stubbed response when stub declares query params both in uri and as a hash" do
|
32
|
+
stub_request(:get, "www.example.com/?x=3").with(:query => {"a" => ["b", "c"]}).to_return(:body => "abc")
|
33
|
+
http_request(:get, "http://www.example.com/?x=3&a[]=b&a[]=c").body.should == "abc"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should return stubbed response when stub expects only part of query params" do
|
37
|
+
stub_request(:get, "www.example.com").with(:query => hash_including({"a" => ["b", "c"]})).to_return(:body => "abc")
|
38
|
+
http_request(:get, "http://www.example.com/?a[]=b&a[]=c&b=1").body.should == "abc"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "based on method" do
|
43
|
+
it "should return stubbed response" do
|
44
|
+
stub_request(:get, "www.example.com")
|
45
|
+
http_request(:get, "http://www.example.com/").status.should == "200"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should raise error if stubbed request has different method" do
|
49
|
+
stub_request(:get, "www.example.com")
|
50
|
+
http_request(:get, "http://www.example.com/").status.should == "200"
|
51
|
+
lambda {
|
52
|
+
http_request(:delete, "http://www.example.com/")
|
53
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: DELETE http://www.example.com/)
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "based on body" do
|
59
|
+
it "should match requests if body is the same" do
|
60
|
+
stub_request(:post, "www.example.com").with(:body => "abc")
|
61
|
+
http_request(
|
62
|
+
:post, "http://www.example.com/",
|
63
|
+
:body => "abc").status.should == "200"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should match requests if body is not set in the stub" do
|
67
|
+
stub_request(:post, "www.example.com")
|
68
|
+
http_request(
|
69
|
+
:post, "http://www.example.com/",
|
70
|
+
:body => "abc").status.should == "200"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should not match requests if body is different" do
|
74
|
+
stub_request(:post, "www.example.com").with(:body => "abc")
|
75
|
+
lambda {
|
76
|
+
http_request(:post, "http://www.example.com/", :body => "def")
|
77
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: POST http://www.example.com/ with body 'def'))
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "with regular expressions" do
|
81
|
+
it "should match requests if body matches regexp" do
|
82
|
+
stub_request(:post, "www.example.com").with(:body => /\d+abc$/)
|
83
|
+
http_request(
|
84
|
+
:post, "http://www.example.com/",
|
85
|
+
:body => "123abc").status.should == "200"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should not match requests if body doesn't match regexp" do
|
89
|
+
stub_request(:post, "www.example.com").with(:body => /^abc/)
|
90
|
+
lambda {
|
91
|
+
http_request(:post, "http://www.example.com/", :body => "xabc")
|
92
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: POST http://www.example.com/ with body 'xabc'))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "when body is declared as a hash" do
|
97
|
+
before(:each) do
|
98
|
+
stub_request(:post, "www.example.com").
|
99
|
+
with(:body => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']} })
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "for request with url encoded body" do
|
103
|
+
it "should match request if hash matches body" do
|
104
|
+
http_request(
|
105
|
+
:post, "http://www.example.com/",
|
106
|
+
:body => 'a=1&c[d][]=e&c[d][]=f&b=five').status.should == "200"
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should match request if hash matches body in different order of params" do
|
110
|
+
http_request(
|
111
|
+
:post, "http://www.example.com/",
|
112
|
+
:body => 'a=1&c[d][]=e&b=five&c[d][]=f').status.should == "200"
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should not match if hash doesn't match url encoded body" do
|
116
|
+
lambda {
|
117
|
+
http_request(
|
118
|
+
:post, "http://www.example.com/",
|
119
|
+
:body => 'c[d][]=f&a=1&c[d][]=e')
|
120
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: POST http://www.example.com/ with body 'c\[d\]\[\]=f&a=1&c\[d\]\[\]=e'))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
describe "for request with json body and content type is set to json" do
|
126
|
+
it "should match if hash matches body" do
|
127
|
+
http_request(
|
128
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
|
129
|
+
:body => "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}").status.should == "200"
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should match if hash matches body in different form" do
|
133
|
+
http_request(
|
134
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
|
135
|
+
:body => "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}").status.should == "200"
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should match if hash contains date string" do #Crack creates date object
|
139
|
+
WebMock.reset!
|
140
|
+
stub_request(:post, "www.example.com").
|
141
|
+
with(:body => {"foo" => "2010-01-01"})
|
142
|
+
http_request(
|
143
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
|
144
|
+
:body => "{\"foo\":\"2010-01-01\"}").status.should == "200"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "for request with xml body and content type is set to xml" do
|
149
|
+
before(:each) do
|
150
|
+
WebMock.reset!
|
151
|
+
stub_request(:post, "www.example.com").
|
152
|
+
with(:body => { "opt" => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']} }})
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should match if hash matches body" do
|
156
|
+
http_request(
|
157
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/xml'},
|
158
|
+
:body => "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n").status.should == "200"
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should match if hash matches body in different form" do
|
162
|
+
http_request(
|
163
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/xml'},
|
164
|
+
:body => "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n").status.should == "200"
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should match if hash contains date string" do #Crack creates date object
|
168
|
+
WebMock.reset!
|
169
|
+
stub_request(:post, "www.example.com").
|
170
|
+
with(:body => {"opt" => {"foo" => "2010-01-01"}})
|
171
|
+
http_request(
|
172
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/xml'},
|
173
|
+
:body => "<opt foo=\"2010-01-01\">\n</opt>\n").status.should == "200"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
describe "when body is declared as partial hash matcher" do
|
179
|
+
before(:each) do
|
180
|
+
stub_request(:post, "www.example.com").
|
181
|
+
with(:body => hash_including({:a => '1', 'c' => {'d' => ['e', 'f']} }))
|
182
|
+
end
|
183
|
+
|
184
|
+
describe "for request with url encoded body" do
|
185
|
+
it "should match request if hash matches body" do
|
186
|
+
http_request(
|
187
|
+
:post, "http://www.example.com/",
|
188
|
+
:body => 'a=1&c[d][]=e&c[d][]=f&b=five').status.should == "200"
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should not match if hash doesn't match url encoded body" do
|
192
|
+
lambda {
|
193
|
+
http_request(
|
194
|
+
:post, "http://www.example.com/",
|
195
|
+
:body => 'c[d][]=f&a=1&c[d][]=e').status
|
196
|
+
}.should raise_error
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "for request with json body and content type is set to json" do
|
201
|
+
it "should match if hash matches body" do
|
202
|
+
http_request(
|
203
|
+
:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
|
204
|
+
:body => "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}").status.should == "200"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe "based on headers" do
|
211
|
+
it "should match requests if headers are the same" do
|
212
|
+
stub_request(:get, "www.example.com").with(:headers => SAMPLE_HEADERS )
|
213
|
+
http_request(
|
214
|
+
:get, "http://www.example.com/",
|
215
|
+
:headers => SAMPLE_HEADERS).status.should == "200"
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should match requests if headers are the same and declared as array" do
|
219
|
+
stub_request(:get, "www.example.com").with(:headers => {"a" => ["b"]} )
|
220
|
+
http_request(
|
221
|
+
:get, "http://www.example.com/",
|
222
|
+
:headers => {"a" => "b"}).status.should == "200"
|
223
|
+
end
|
224
|
+
|
225
|
+
describe "when multiple headers with the same key are used" do
|
226
|
+
it "should match requests if headers are the same" do
|
227
|
+
stub_request(:get, "www.example.com").with(:headers => {"a" => ["b", "c"]} )
|
228
|
+
http_request(
|
229
|
+
:get, "http://www.example.com/",
|
230
|
+
:headers => {"a" => ["b", "c"]}).status.should == "200"
|
231
|
+
end
|
232
|
+
|
233
|
+
it "should match requests if headers are the same but in different order" do
|
234
|
+
stub_request(:get, "www.example.com").with(:headers => {"a" => ["b", "c"]} )
|
235
|
+
http_request(
|
236
|
+
:get, "http://www.example.com/",
|
237
|
+
:headers => {"a" => ["c", "b"]}).status.should == "200"
|
238
|
+
end
|
239
|
+
|
240
|
+
it "should not match requests if headers are different" do
|
241
|
+
stub_request(:get, "www.example.com").with(:headers => {"a" => ["b", "c"]})
|
242
|
+
|
243
|
+
lambda {
|
244
|
+
http_request(
|
245
|
+
:get, "http://www.example.com/",
|
246
|
+
:headers => {"a" => ["b", "d"]})
|
247
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/ with headers))
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
it "should match requests if request headers are not stubbed" do
|
252
|
+
stub_request(:get, "www.example.com")
|
253
|
+
http_request(
|
254
|
+
:get, "http://www.example.com/",
|
255
|
+
:headers => SAMPLE_HEADERS).status.should == "200"
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should not match requests if headers are different" do
|
259
|
+
stub_request(:get, "www.example.com").with(:headers => SAMPLE_HEADERS)
|
260
|
+
|
261
|
+
lambda {
|
262
|
+
http_request(
|
263
|
+
:get, "http://www.example.com/",
|
264
|
+
:headers => { 'Content-Length' => '9999'})
|
265
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/ with headers))
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should not match if accept header is different" do
|
269
|
+
stub_request(:get, "www.example.com").
|
270
|
+
with(:headers => { 'Accept' => 'application/json'})
|
271
|
+
lambda {
|
272
|
+
http_request(
|
273
|
+
:get, "http://www.example.com/",
|
274
|
+
:headers => { 'Accept' => 'application/xml'})
|
275
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/ with headers))
|
276
|
+
end
|
277
|
+
|
278
|
+
describe "declared as regular expressions" do
|
279
|
+
it "should match requests if header values match regular expression" do
|
280
|
+
stub_request(:get, "www.example.com").with(:headers => { :some_header => /^MyAppName$/ })
|
281
|
+
http_request(
|
282
|
+
:get, "http://www.example.com/",
|
283
|
+
:headers => { 'some-header' => 'MyAppName' }).status.should == "200"
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should not match requests if headers values do not match regular expression" do
|
287
|
+
stub_request(:get, "www.example.com").with(:headers => { :some_header => /^MyAppName$/ })
|
288
|
+
|
289
|
+
lambda {
|
290
|
+
http_request(
|
291
|
+
:get, "http://www.example.com/",
|
292
|
+
:headers => { 'some-header' => 'xMyAppName' })
|
293
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/ with headers))
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
describe "when stubbing request with basic authentication", :unless => (adapter_info.include?(:no_url_auth)) do
|
299
|
+
it "should match if credentials are the same" do
|
300
|
+
stub_request(:get, "user:pass@www.example.com")
|
301
|
+
http_request(:get, "http://user:pass@www.example.com/").status.should == "200"
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should not match if credentials are different" do
|
305
|
+
stub_request(:get, "user:pass@www.example.com")
|
306
|
+
lambda {
|
307
|
+
http_request(:get, "http://user:pazz@www.example.com/").status.should == "200"
|
308
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://user:pazz@www.example.com/))
|
309
|
+
end
|
310
|
+
|
311
|
+
it "should not match if credentials are stubbed but not provided in the request" do
|
312
|
+
stub_request(:get, "user:pass@www.example.com")
|
313
|
+
lambda {
|
314
|
+
http_request(:get, "http://www.example.com/").status.should == "200"
|
315
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should not match if credentials are not stubbed but exist in the request" do
|
319
|
+
stub_request(:get, "www.example.com")
|
320
|
+
lambda {
|
321
|
+
http_request(:get, "http://user:pazz@www.example.com/").status.should == "200"
|
322
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://user:pazz@www.example.com/))
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
describe "when stubbing request with a global hook" do
|
327
|
+
after(:each) do
|
328
|
+
WebMock::StubRegistry.instance.global_stubs.clear
|
329
|
+
end
|
330
|
+
|
331
|
+
it 'returns the response returned by the hook' do
|
332
|
+
WebMock.globally_stub_request do |request|
|
333
|
+
{ :body => "global stub body" }
|
334
|
+
end
|
335
|
+
|
336
|
+
http_request(:get, "http://www.example.com/").body.should == "global stub body"
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'does not get cleared when a user calls WebMock.reset!' do
|
340
|
+
WebMock.globally_stub_request do |request|
|
341
|
+
{ :body => "global stub body" }
|
342
|
+
end
|
343
|
+
WebMock.reset!
|
344
|
+
http_request(:get, "http://www.example.com/").body.should == "global stub body"
|
345
|
+
end
|
346
|
+
|
347
|
+
it "does not stub the request if the hook does not return anything" do
|
348
|
+
WebMock.globally_stub_request { |r| }
|
349
|
+
lambda {
|
350
|
+
http_request(:get, "http://www.example.com/")
|
351
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
352
|
+
end
|
353
|
+
|
354
|
+
it "passes the request to the block" do
|
355
|
+
passed_request = nil
|
356
|
+
WebMock.globally_stub_request do |request|
|
357
|
+
passed_request = request
|
358
|
+
{ :body => "global stub body" }
|
359
|
+
end
|
360
|
+
|
361
|
+
http_request(:get, "http://www.example.com:456/bar")
|
362
|
+
passed_request.uri.to_s.should == "http://www.example.com:456/bar"
|
363
|
+
end
|
364
|
+
|
365
|
+
it "should call the block only once per request" do
|
366
|
+
call_count = 0
|
367
|
+
WebMock.globally_stub_request do |request|
|
368
|
+
call_count += 1
|
369
|
+
{ :body => "global stub body" }
|
370
|
+
end
|
371
|
+
http_request(:get, "http://www.example.com/")
|
372
|
+
call_count.should == 1
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'supports multiple global stubs; the first registered one that returns a non-nil value determines the stub' do
|
376
|
+
stub_invocation_order = []
|
377
|
+
WebMock.globally_stub_request do |request|
|
378
|
+
stub_invocation_order << :nil_stub
|
379
|
+
nil
|
380
|
+
end
|
381
|
+
|
382
|
+
WebMock.globally_stub_request do |request|
|
383
|
+
stub_invocation_order << :hash_stub
|
384
|
+
{ :body => "global stub body" }
|
385
|
+
end
|
386
|
+
|
387
|
+
http_request(:get, "http://www.example.com/").body.should == "global stub body"
|
388
|
+
stub_invocation_order.should eq([:nil_stub, :hash_stub])
|
389
|
+
end
|
390
|
+
|
391
|
+
[:before, :after].each do |before_or_after|
|
392
|
+
context "when there is also a non-global registered stub #{before_or_after} the global stub" do
|
393
|
+
def stub_non_globally
|
394
|
+
stub_request(:get, "www.example.com").to_return(:body => 'non-global stub body')
|
395
|
+
end
|
396
|
+
|
397
|
+
define_method :register_stubs do |block|
|
398
|
+
stub_non_globally if before_or_after == :before
|
399
|
+
WebMock.globally_stub_request(&block)
|
400
|
+
stub_non_globally if before_or_after == :after
|
401
|
+
end
|
402
|
+
|
403
|
+
it 'uses the response from the global stub if the block returns a non-nil value' do
|
404
|
+
register_stubs(lambda { |req| { :body => 'global stub body' } })
|
405
|
+
http_request(:get, "http://www.example.com/").body.should == "global stub body"
|
406
|
+
end
|
407
|
+
|
408
|
+
it 'uses the response from the non-global stub if the block returns a nil value' do
|
409
|
+
register_stubs(lambda { |req| nil })
|
410
|
+
http_request(:get, "http://www.example.com/").body.should == "non-global stub body"
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
describe "when stubbing request with a block evaluated on request" do
|
417
|
+
it "should match if block returns true" do
|
418
|
+
stub_request(:get, "www.example.com").with { |request| true }
|
419
|
+
http_request(:get, "http://www.example.com/").status.should == "200"
|
420
|
+
end
|
421
|
+
|
422
|
+
it "should not match if block returns false" do
|
423
|
+
stub_request(:get, "www.example.com").with { |request| false }
|
424
|
+
lambda {
|
425
|
+
http_request(:get, "http://www.example.com/")
|
426
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com/))
|
427
|
+
end
|
428
|
+
|
429
|
+
it "should pass the request to the block" do
|
430
|
+
stub_request(:post, "www.example.com").with { |request| request.body == "wadus" }
|
431
|
+
http_request(
|
432
|
+
:post, "http://www.example.com/",
|
433
|
+
:body => "wadus").status.should == "200"
|
434
|
+
lambda {
|
435
|
+
http_request(:post, "http://www.example.com/", :body => "jander")
|
436
|
+
}.should raise_error(WebMock::NetConnectNotAllowedError, %r(Real HTTP connections are disabled. Unregistered request: POST http://www.example.com/ with body 'jander'))
|
437
|
+
end
|
438
|
+
|
439
|
+
it "should call the block only once per request" do
|
440
|
+
call_count = 0
|
441
|
+
stub_request(:get, "www.example.com").with { |request| call_count += 1; true }
|
442
|
+
http_request(:get, "http://www.example.com/").status.should == "200"
|
443
|
+
call_count.should == 1
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
end
|
data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'acceptance/webmock_shared'
|
3
|
+
|
4
|
+
unless RUBY_PLATFORM =~ /java/
|
5
|
+
require 'acceptance/typhoeus/typhoeus_hydra_spec_helper'
|
6
|
+
|
7
|
+
describe "Typhoeus::Hydra" do
|
8
|
+
include TyphoeusHydraSpecHelper
|
9
|
+
|
10
|
+
include_context "with WebMock"
|
11
|
+
|
12
|
+
describe "Typhoeus::Hydra features" do
|
13
|
+
before(:each) do
|
14
|
+
WebMock.disable_net_connect!
|
15
|
+
WebMock.reset!
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "when params are used" do
|
19
|
+
it "should take into account params for POST request" do
|
20
|
+
stub_request(:post, "www.example.com").with(:body => {:hello => 'world'})
|
21
|
+
Typhoeus::Request.post("www.example.com", :params => {:hello => 'world'})
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should take into account params for GET request" do
|
25
|
+
stub_request(:get, "http://www.example.com/?hello=world")
|
26
|
+
Typhoeus::Request.get("www.example.com", :params => {:hello => 'world'})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "timeouts" do
|
31
|
+
it "should support native typhoeus timeouts" do
|
32
|
+
stub_request(:any, "example.com").to_timeout
|
33
|
+
|
34
|
+
response = Typhoeus::Request.get("http://example.com")
|
35
|
+
|
36
|
+
response.should be_timed_out
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "callbacks" do
|
41
|
+
before(:each) do
|
42
|
+
@hydra = Typhoeus::Hydra.new
|
43
|
+
@request = Typhoeus::Request.new("http://example.com")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should call on_complete with 2xx response" do
|
47
|
+
body = "on_success fired"
|
48
|
+
stub_request(:any, "example.com").to_return(:body => body)
|
49
|
+
|
50
|
+
test = nil
|
51
|
+
@hydra.on_complete do |c|
|
52
|
+
test = c.body
|
53
|
+
end
|
54
|
+
@hydra.queue @request
|
55
|
+
@hydra.run
|
56
|
+
test.should == body
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should call on_complete with 5xx response" do
|
60
|
+
response_code = 599
|
61
|
+
stub_request(:any, "example.com").to_return(:status => [response_code, "Server On Fire"])
|
62
|
+
|
63
|
+
test = nil
|
64
|
+
@hydra.on_complete do |c|
|
65
|
+
test = c.code
|
66
|
+
end
|
67
|
+
@hydra.queue @request
|
68
|
+
@hydra.run
|
69
|
+
test.should == response_code
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module TyphoeusHydraSpecHelper
|
4
|
+
class FakeTyphoeusHydraTimeoutError < StandardError; end
|
5
|
+
class FakeTyphoeusHydraConnectError < StandardError; end
|
6
|
+
|
7
|
+
|
8
|
+
def http_request(method, uri, options = {}, &block)
|
9
|
+
uri.gsub!(" ", "%20") #typhoeus doesn't like spaces in the uri
|
10
|
+
request = Typhoeus::Request.new(uri,
|
11
|
+
{
|
12
|
+
:method => method,
|
13
|
+
:body => options[:body],
|
14
|
+
:headers => options[:headers],
|
15
|
+
:timeout => 25000
|
16
|
+
}
|
17
|
+
)
|
18
|
+
hydra = Typhoeus::Hydra.new(:initial_pool_size => 0)
|
19
|
+
hydra.queue(request)
|
20
|
+
hydra.run
|
21
|
+
response = request.response
|
22
|
+
raise FakeTyphoeusHydraTimeoutError.new if response.timed_out?
|
23
|
+
raise FakeTyphoeusHydraConnectError.new if response.code == 0
|
24
|
+
OpenStruct.new({
|
25
|
+
:body => response.body,
|
26
|
+
:headers => WebMock::Util::Headers.normalize_headers(join_array_values(response.headers_hash)),
|
27
|
+
:status => response.code.to_s,
|
28
|
+
:message => response.status_message
|
29
|
+
})
|
30
|
+
end
|
31
|
+
|
32
|
+
def join_array_values(hash)
|
33
|
+
joined = {}
|
34
|
+
if hash
|
35
|
+
hash.each do |k,v|
|
36
|
+
v = v.join(", ") if v.is_a?(Array)
|
37
|
+
joined[k] = v
|
38
|
+
end
|
39
|
+
end
|
40
|
+
joined
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def client_timeout_exception_class
|
45
|
+
FakeTyphoeusHydraTimeoutError
|
46
|
+
end
|
47
|
+
|
48
|
+
def connection_refused_exception_class
|
49
|
+
FakeTyphoeusHydraConnectError
|
50
|
+
end
|
51
|
+
|
52
|
+
def http_library
|
53
|
+
:typhoeus
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'acceptance/shared/enabling_and_disabling_webmock'
|
3
|
+
require 'acceptance/shared/returning_declared_responses'
|
4
|
+
require 'acceptance/shared/callbacks'
|
5
|
+
require 'acceptance/shared/request_expectations'
|
6
|
+
require 'acceptance/shared/stubbing_requests'
|
7
|
+
require 'acceptance/shared/allowing_and_disabling_net_connect'
|
8
|
+
require 'acceptance/shared/precedence_of_stubs'
|
9
|
+
require 'acceptance/shared/complex_cross_concern_behaviors'
|
10
|
+
|
11
|
+
unless defined? SAMPLE_HEADERS
|
12
|
+
SAMPLE_HEADERS = { "Content-Length" => "8888", "Accept" => "application/json" }
|
13
|
+
ESCAPED_PARAMS = "x=ab%20c&z=%27Stop%21%27%20said%20Fred"
|
14
|
+
NOT_ESCAPED_PARAMS = "z='Stop!' said Fred&x=ab c"
|
15
|
+
end
|
16
|
+
|
17
|
+
shared_examples "with WebMock" do |*adapter_info|
|
18
|
+
describe "with WebMock" do
|
19
|
+
let(:webmock_server_url) {"http://#{WebMockServer.instance.host_with_port}/"}
|
20
|
+
before(:each) do
|
21
|
+
WebMock.disable_net_connect!
|
22
|
+
WebMock.reset!
|
23
|
+
end
|
24
|
+
|
25
|
+
include_context "allowing and disabling net connect", *adapter_info
|
26
|
+
|
27
|
+
include_context "stubbing requests", *adapter_info
|
28
|
+
|
29
|
+
include_context "declared responses", *adapter_info
|
30
|
+
|
31
|
+
include_context "precedence of stubs", *adapter_info
|
32
|
+
|
33
|
+
include_context "request expectations", *adapter_info
|
34
|
+
|
35
|
+
include_context "callbacks", *adapter_info
|
36
|
+
|
37
|
+
include_context "enabled and disabled webmock", *adapter_info
|
38
|
+
|
39
|
+
include_context "complex cross-concern behaviors", *adapter_info
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
# Borrowed from Bundler
|
4
|
+
# https://github.com/carlhuda/bundler/blob/1-0-stable/spec/quality_spec.rb
|
5
|
+
describe "The library itself" do
|
6
|
+
def check_for_tab_characters(filename)
|
7
|
+
failing_lines = []
|
8
|
+
File.readlines(filename).each_with_index do |line,number|
|
9
|
+
failing_lines << number + 1 if line =~ /\t/
|
10
|
+
end
|
11
|
+
|
12
|
+
unless failing_lines.empty?
|
13
|
+
"#{filename} has tab characters on lines #{failing_lines.join(', ')}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_for_extra_spaces(filename)
|
18
|
+
failing_lines = []
|
19
|
+
File.readlines(filename).each_with_index do |line,number|
|
20
|
+
next if line =~ /^\s+#.*\s+\n$/
|
21
|
+
failing_lines << number + 1 if line =~ /\s+\n$/
|
22
|
+
end
|
23
|
+
|
24
|
+
unless failing_lines.empty?
|
25
|
+
"#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
RSpec::Matchers.define :be_well_formed do
|
30
|
+
failure_message_for_should do |actual|
|
31
|
+
actual.join("\n")
|
32
|
+
end
|
33
|
+
|
34
|
+
match do |actual|
|
35
|
+
actual.empty?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "has no malformed whitespace" do
|
40
|
+
error_messages = []
|
41
|
+
Dir.chdir(File.expand_path("../..", __FILE__)) do
|
42
|
+
`git ls-files`.split("\n").each do |filename|
|
43
|
+
next if filename =~ /\.gitmodules|fixtures/
|
44
|
+
error_messages << check_for_tab_characters(filename)
|
45
|
+
error_messages << check_for_extra_spaces(filename)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
error_messages.compact.should be_well_formed
|
49
|
+
end
|
50
|
+
|
51
|
+
it "can still be built" do
|
52
|
+
Dir.chdir(File.expand_path('../../', __FILE__)) do
|
53
|
+
`gem build webmock.gemspec`
|
54
|
+
$?.should == 0
|
55
|
+
|
56
|
+
# clean up the .gem generated
|
57
|
+
system("rm webmock-#{WebMock.version}.gem")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|