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,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WebMock::RequestSignature do
|
4
|
+
|
5
|
+
describe "initialization" do
|
6
|
+
|
7
|
+
it "should have assigned normalized uri" do
|
8
|
+
WebMock::Util::URI.should_receive(:normalize_uri).and_return("www.example.kom")
|
9
|
+
signature = WebMock::RequestSignature.new(:get, "www.example.com")
|
10
|
+
signature.uri.should == "www.example.kom"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have assigned uri without normalization if uri is URI" do
|
14
|
+
WebMock::Util::URI.should_not_receive(:normalize_uri)
|
15
|
+
uri = Addressable::URI.parse("www.example.com")
|
16
|
+
signature = WebMock::RequestSignature.new(:get, uri)
|
17
|
+
signature.uri.should == uri
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have assigned normalized headers" do
|
21
|
+
WebMock::Util::Headers.should_receive(:normalize_headers).with('A' => 'a').and_return('B' => 'b')
|
22
|
+
WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}).headers.should == {'B' => 'b'}
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have assigned body" do
|
26
|
+
WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc").body.should == "abc"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should report string describing itself" do
|
32
|
+
WebMock::RequestSignature.new(:get, "www.example.com",
|
33
|
+
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).to_s.should ==
|
34
|
+
"GET http://www.example.com/ with body 'abc' with headers {'A'=>'a', 'B'=>'b'}"
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "hash" do
|
38
|
+
it "should report same hash for two signatures with the same values" do
|
39
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com",
|
40
|
+
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'})
|
41
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.com",
|
42
|
+
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'})
|
43
|
+
signature1.hash.should == signature2.hash
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should report different hash for two signatures with different method" do
|
47
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com")
|
48
|
+
signature2 = WebMock::RequestSignature.new(:put, "www.example.com")
|
49
|
+
signature1.hash.should_not == signature2.hash
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should report different hash for two signatures with different uri" do
|
53
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com")
|
54
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.org")
|
55
|
+
signature1.hash.should_not == signature2.hash
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should report different hash for two signatures with different body" do
|
59
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc")
|
60
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.com", :body => "def")
|
61
|
+
signature1.hash.should_not == signature2.hash
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should report different hash for two signatures with different headers" do
|
65
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com",
|
66
|
+
:headers => {'A' => 'a'})
|
67
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.com",
|
68
|
+
:headers => {'A' => 'A'})
|
69
|
+
signature1.hash.should_not == signature2.hash
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
[:==, :eql?].each do |method|
|
75
|
+
describe method do
|
76
|
+
it "should be true for two signatures with the same values" do
|
77
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com",
|
78
|
+
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'})
|
79
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.com",
|
80
|
+
:body => "abc", :headers => {'A' => 'a', 'B' => 'b'})
|
81
|
+
|
82
|
+
signature1.send(method, signature2).should be_true
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should be false for two signatures with different method" do
|
86
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com")
|
87
|
+
signature2 = WebMock::RequestSignature.new(:put, "www.example.com")
|
88
|
+
signature1.send(method, signature2).should be_false
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should be false for two signatures with different uri" do
|
92
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com")
|
93
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.org")
|
94
|
+
signature1.send(method, signature2).should be_false
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should be false for two signatures with different body" do
|
98
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc")
|
99
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.com", :body => "def")
|
100
|
+
signature1.send(method, signature2).should be_false
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should be false for two signatures with different headers" do
|
104
|
+
signature1 = WebMock::RequestSignature.new(:get, "www.example.com",
|
105
|
+
:headers => {'A' => 'a'})
|
106
|
+
signature2 = WebMock::RequestSignature.new(:get, "www.example.com",
|
107
|
+
:headers => {'A' => 'A'})
|
108
|
+
signature1.send(method, signature2).should be_false
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WebMock::RequestStub do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@request_stub = WebMock::RequestStub.new(:get, "www.example.com")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have request pattern with method and uri" do
|
10
|
+
@request_stub.request_pattern.to_s.should == "GET http://www.example.com/"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have response" do
|
14
|
+
@request_stub.response.should be_a(WebMock::Response)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "with" do
|
18
|
+
|
19
|
+
it "should assign body to request pattern" do
|
20
|
+
@request_stub.with(:body => "abc")
|
21
|
+
@request_stub.request_pattern.to_s.should == WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should assign normalized headers to request pattern" do
|
25
|
+
@request_stub.with(:headers => {'A' => 'a'})
|
26
|
+
@request_stub.request_pattern.to_s.should ==
|
27
|
+
WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should assign given block to request profile" do
|
31
|
+
@request_stub.with { |req| req.body == "abc" }
|
32
|
+
@request_stub.request_pattern.matches?(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc")).should be_true
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "to_return" do
|
38
|
+
|
39
|
+
it "should assign response with provided options" do
|
40
|
+
@request_stub.to_return(:body => "abc", :status => 500)
|
41
|
+
@request_stub.response.body.should == "abc"
|
42
|
+
@request_stub.response.status.should == [500, ""]
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should assign responses with provided options" do
|
46
|
+
@request_stub.to_return([{:body => "abc"}, {:body => "def"}])
|
47
|
+
[@request_stub.response.body, @request_stub.response.body].should == ["abc", "def"]
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "then" do
|
53
|
+
it "should return stub without any modifications, acting as syntactic sugar" do
|
54
|
+
@request_stub.then.should == @request_stub
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "response" do
|
59
|
+
|
60
|
+
it "should return responses in a sequence passed as array" do
|
61
|
+
@request_stub.to_return([{:body => "abc"}, {:body => "def"}])
|
62
|
+
@request_stub.response.body.should == "abc"
|
63
|
+
@request_stub.response.body.should == "def"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should repeat returning last response" do
|
67
|
+
@request_stub.to_return([{:body => "abc"}, {:body => "def"}])
|
68
|
+
@request_stub.response
|
69
|
+
@request_stub.response
|
70
|
+
@request_stub.response.body.should == "def"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return responses in a sequence passed as comma separated params" do
|
74
|
+
@request_stub.to_return({:body => "abc"}, {:body => "def"})
|
75
|
+
@request_stub.response.body.should == "abc"
|
76
|
+
@request_stub.response.body.should == "def"
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should return responses declared in multiple to_return declarations" do
|
80
|
+
@request_stub.to_return({:body => "abc"}).to_return({:body => "def"})
|
81
|
+
@request_stub.response.body.should == "abc"
|
82
|
+
@request_stub.response.body.should == "def"
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "to_raise" do
|
88
|
+
|
89
|
+
it "should assign response with exception to be thrown" do
|
90
|
+
@request_stub.to_raise(ArgumentError)
|
91
|
+
lambda {
|
92
|
+
@request_stub.response.raise_error_if_any
|
93
|
+
}.should raise_error(ArgumentError, "Exception from WebMock")
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should assign sequence of responses with response with exception to be thrown" do
|
97
|
+
@request_stub.to_return(:body => "abc").then.to_raise(ArgumentError)
|
98
|
+
@request_stub.response.body.should == "abc"
|
99
|
+
lambda {
|
100
|
+
@request_stub.response.raise_error_if_any
|
101
|
+
}.should raise_error(ArgumentError, "Exception from WebMock")
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should assign a list responses to be thrown in a sequence" do
|
105
|
+
@request_stub.to_raise(ArgumentError, IndexError)
|
106
|
+
lambda {
|
107
|
+
@request_stub.response.raise_error_if_any
|
108
|
+
}.should raise_error(ArgumentError, "Exception from WebMock")
|
109
|
+
lambda {
|
110
|
+
@request_stub.response.raise_error_if_any
|
111
|
+
}.should raise_error(IndexError, "Exception from WebMock")
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should raise exceptions declared in multiple to_raise declarations" do
|
115
|
+
@request_stub.to_raise(ArgumentError).then.to_raise(IndexError)
|
116
|
+
lambda {
|
117
|
+
@request_stub.response.raise_error_if_any
|
118
|
+
}.should raise_error(ArgumentError, "Exception from WebMock")
|
119
|
+
lambda {
|
120
|
+
@request_stub.response.raise_error_if_any
|
121
|
+
}.should raise_error(IndexError, "Exception from WebMock")
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "to_timeout" do
|
127
|
+
|
128
|
+
it "should assign response with timeout" do
|
129
|
+
@request_stub.to_timeout
|
130
|
+
@request_stub.response.should_timeout.should be_true
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should assign sequence of responses with response with timeout" do
|
134
|
+
@request_stub.to_return(:body => "abc").then.to_timeout
|
135
|
+
@request_stub.response.body.should == "abc"
|
136
|
+
@request_stub.response.should_timeout.should be_true
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should allow multiple timeouts to be declared" do
|
140
|
+
@request_stub.to_timeout.then.to_timeout.then.to_return(:body => "abc")
|
141
|
+
@request_stub.response.should_timeout.should be_true
|
142
|
+
@request_stub.response.should_timeout.should be_true
|
143
|
+
@request_stub.response.body.should == "abc"
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
describe "times" do
|
150
|
+
|
151
|
+
it "should give error if declared before any response declaration is declared" do
|
152
|
+
lambda {
|
153
|
+
@request_stub.times(3)
|
154
|
+
}.should raise_error("Invalid WebMock stub declaration. times(N) can be declared only after response declaration.")
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should repeat returning last declared response declared number of times" do
|
158
|
+
@request_stub.to_return({:body => "abc"}).times(2).then.to_return({:body => "def"})
|
159
|
+
@request_stub.response.body.should == "abc"
|
160
|
+
@request_stub.response.body.should == "abc"
|
161
|
+
@request_stub.response.body.should == "def"
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should repeat raising last declared exception declared number of times" do
|
165
|
+
@request_stub.to_return({:body => "abc"}).times(2).then.to_return({:body => "def"})
|
166
|
+
@request_stub.response.body.should == "abc"
|
167
|
+
@request_stub.response.body.should == "abc"
|
168
|
+
@request_stub.response.body.should == "def"
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should repeat returning last declared sequence of responses declared number of times" do
|
172
|
+
@request_stub.to_return({:body => "abc"}, {:body => "def"}).times(2).then.to_return({:body => "ghj"})
|
173
|
+
@request_stub.response.body.should == "abc"
|
174
|
+
@request_stub.response.body.should == "def"
|
175
|
+
@request_stub.response.body.should == "abc"
|
176
|
+
@request_stub.response.body.should == "def"
|
177
|
+
@request_stub.response.body.should == "ghj"
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should return self" do
|
181
|
+
@request_stub.to_return({:body => "abc"}).times(1).should == @request_stub
|
182
|
+
end
|
183
|
+
|
184
|
+
it "should raise error if argument is not integer" do
|
185
|
+
lambda {
|
186
|
+
@request_stub.to_return({:body => "abc"}).times("not number")
|
187
|
+
}.should raise_error("times(N) accepts integers >= 1 only")
|
188
|
+
end
|
189
|
+
|
190
|
+
it "should raise error if argument is < 1" do
|
191
|
+
lambda {
|
192
|
+
@request_stub.to_return({:body => "abc"}).times(0)
|
193
|
+
}.should raise_error("times(N) accepts integers >= 1 only")
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
@@ -0,0 +1,267 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WebMock::ResponseFactory do
|
4
|
+
|
5
|
+
describe "response_for" do
|
6
|
+
|
7
|
+
it "should create response with options passed as arguments" do
|
8
|
+
options = {:body => "abc", :headers => {:a => :b}}
|
9
|
+
WebMock::Response.should_receive(:new).with(options).and_return(@response = mock(WebMock::Response))
|
10
|
+
WebMock::ResponseFactory.response_for(options).should == @response
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
it "should create dynamic response for argument responding to call" do
|
15
|
+
callable = mock(:call => {:body => "abc"})
|
16
|
+
WebMock::DynamicResponse.should_receive(:new).with(callable).and_return(@response = mock(WebMock::Response))
|
17
|
+
WebMock::ResponseFactory.response_for(callable).should == @response
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
describe WebMock::Response do
|
25
|
+
before(:each) do
|
26
|
+
@response = WebMock::Response.new(:headers => {'A' => 'a'})
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should report normalized headers" do
|
30
|
+
WebMock::Util::Headers.should_receive(:normalize_headers).with('A' => 'a').and_return('B' => 'b')
|
31
|
+
@response = WebMock::Response.new(:headers => {'A' => 'a'})
|
32
|
+
@response.headers.should == {'B' => 'b'}
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "status" do
|
36
|
+
|
37
|
+
it "should have 200 code and empty message by default" do
|
38
|
+
@response.status.should == [200, ""]
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should return assigned status" do
|
42
|
+
@response = WebMock::Response.new(:status => 500)
|
43
|
+
@response.status.should == [500, ""]
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return assigned message" do
|
47
|
+
@response = WebMock::Response.new(:status => [500, "Internal Server Error"])
|
48
|
+
@response.status.should == [500, "Internal Server Error"]
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "raising error" do
|
54
|
+
|
55
|
+
it "should raise error if any assigned" do
|
56
|
+
@response = WebMock::Response.new(:exception => ArgumentError)
|
57
|
+
lambda {
|
58
|
+
@response.raise_error_if_any
|
59
|
+
}.should raise_error(ArgumentError, "Exception from WebMock")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should raise error if any assigned as instance" do
|
63
|
+
@response = WebMock::Response.new(:exception => ArgumentError.new("hello world"))
|
64
|
+
lambda {
|
65
|
+
@response.raise_error_if_any
|
66
|
+
}.should raise_error(ArgumentError, "hello world")
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should raise error if any assigned as string" do
|
70
|
+
@response = WebMock::Response.new(:exception => "hello world")
|
71
|
+
lambda {
|
72
|
+
@response.raise_error_if_any
|
73
|
+
}.should raise_error("hello world")
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should not raise error if no error assigned" do
|
77
|
+
@response.raise_error_if_any
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "timeout" do
|
83
|
+
|
84
|
+
it "should know if it should timeout" do
|
85
|
+
@response = WebMock::Response.new(:should_timeout => true)
|
86
|
+
@response.should_timeout.should be_true
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should not timeout by default" do
|
90
|
+
@response = WebMock::Response.new
|
91
|
+
@response.should_timeout.should be_false
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "body" do
|
97
|
+
|
98
|
+
it "should return empty body by default" do
|
99
|
+
@response.body.should == ''
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should report body if assigned" do
|
103
|
+
@response = WebMock::Response.new(:body => "abc")
|
104
|
+
@response.body.should == "abc"
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should report string even if existing file path was provided" do
|
108
|
+
@response = WebMock::Response.new(:body => __FILE__)
|
109
|
+
@response.body.should == __FILE__
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should report content of a IO object if provided" do
|
113
|
+
@response = WebMock::Response.new(:body => File.new(__FILE__))
|
114
|
+
@response.body.should == File.new(__FILE__).read
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should report many times content of a IO object if provided" do
|
118
|
+
@response = WebMock::Response.new(:body => File.new(__FILE__))
|
119
|
+
@response.body.should == File.new(__FILE__).read
|
120
|
+
@response.body.should == File.new(__FILE__).read
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "from raw response" do
|
126
|
+
|
127
|
+
describe "when input is IO" do
|
128
|
+
before(:each) do
|
129
|
+
@file = File.new(CURL_EXAMPLE_OUTPUT_PATH)
|
130
|
+
@response = WebMock::Response.new(@file)
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
it "should read status" do
|
135
|
+
@response.status.should == [202, "OK"]
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should read headers" do
|
139
|
+
@response.headers.should == {
|
140
|
+
"Date"=>"Sat, 23 Jan 2010 01:01:05 GMT",
|
141
|
+
"Content-Type"=>"text/html; charset=UTF-8",
|
142
|
+
"Content-Length"=>"419",
|
143
|
+
"Connection"=>"Keep-Alive",
|
144
|
+
"Accept"=>"image/jpeg, image/png"
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should read body" do
|
149
|
+
@response.body.size.should == 419
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should close IO" do
|
153
|
+
@file.should be_closed
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "when input is String" do
|
159
|
+
before(:each) do
|
160
|
+
@input = File.new(CURL_EXAMPLE_OUTPUT_PATH).read
|
161
|
+
@response = WebMock::Response.new(@input)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should read status" do
|
165
|
+
@response.status.should == [202, "OK"]
|
166
|
+
end
|
167
|
+
|
168
|
+
it "should read headers" do
|
169
|
+
@response.headers.should == {
|
170
|
+
"Date"=>"Sat, 23 Jan 2010 01:01:05 GMT",
|
171
|
+
"Content-Type"=>"text/html; charset=UTF-8",
|
172
|
+
"Content-Length"=>"419",
|
173
|
+
"Connection"=>"Keep-Alive",
|
174
|
+
"Accept"=>"image/jpeg, image/png"
|
175
|
+
}
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should read body" do
|
179
|
+
@response.body.size.should == 419
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should work with transfer-encoding set to chunked" do
|
183
|
+
@input.gsub!("Content-Length: 419", "Transfer-Encoding: chunked")
|
184
|
+
@response = WebMock::Response.new(@input)
|
185
|
+
@response.body.size.should == 419
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
describe "with dynamically evaluated options" do
|
191
|
+
|
192
|
+
before(:each) do
|
193
|
+
@request_signature = WebMock::RequestSignature.new(:post, "www.example.com", :body => "abc", :headers => {'A' => 'a'})
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should have evaluated body" do
|
197
|
+
@response = WebMock::Response.new(:body => lambda {|request| request.body})
|
198
|
+
@response.evaluate(@request_signature).body.should == "abc"
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should have evaluated headers" do
|
202
|
+
@response = WebMock::Response.new(:headers => lambda {|request| request.headers})
|
203
|
+
@response.evaluate(@request_signature).headers.should == {'A' => 'a'}
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should have evaluated status" do
|
207
|
+
@response = WebMock::Response.new(:status => lambda {|request| 302})
|
208
|
+
@response.evaluate(@request_signature).status.should == [302, ""]
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
|
215
|
+
describe WebMock::DynamicResponse do
|
216
|
+
|
217
|
+
describe "evaluating response options" do
|
218
|
+
|
219
|
+
it "should evaluate new response with evaluated options" do
|
220
|
+
request_signature = WebMock::RequestSignature.new(:post, "www.example.com", :body => "abc", :headers => {'A' => 'a'})
|
221
|
+
response = WebMock::DynamicResponse.new(lambda {|request|
|
222
|
+
{
|
223
|
+
:body => request.body,
|
224
|
+
:headers => request.headers,
|
225
|
+
:status => 302
|
226
|
+
}
|
227
|
+
})
|
228
|
+
evaluated_response = response.evaluate(request_signature)
|
229
|
+
evaluated_response.body.should == "abc"
|
230
|
+
evaluated_response.headers.should == {'A' => 'a'}
|
231
|
+
evaluated_response.status.should == [302, ""]
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should be equal to static response after evaluation" do
|
235
|
+
request_signature = WebMock::RequestSignature.new(:post, "www.example.com", :body => "abc")
|
236
|
+
response = WebMock::DynamicResponse.new(lambda {|request| {:body => request.body}})
|
237
|
+
evaluated_response = response.evaluate(request_signature)
|
238
|
+
evaluated_response.should == WebMock::Response.new(:body => "abc")
|
239
|
+
end
|
240
|
+
|
241
|
+
describe "when raw response is evaluated" do
|
242
|
+
before(:each) do
|
243
|
+
@files = {
|
244
|
+
"www.example.com" => File.new(CURL_EXAMPLE_OUTPUT_PATH)
|
245
|
+
}
|
246
|
+
@request_signature = WebMock::RequestSignature.new(:get, "www.example.com")
|
247
|
+
end
|
248
|
+
|
249
|
+
describe "as a file" do
|
250
|
+
it "should return response" do
|
251
|
+
response = WebMock::DynamicResponse.new(lambda {|request| @files[request.uri.host.to_s] })
|
252
|
+
response.evaluate(@request_signature).body.size.should == 419
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
describe "as a string" do
|
257
|
+
it "should return response" do
|
258
|
+
response = WebMock::DynamicResponse.new(lambda {|request| @files[request.uri.host.to_s].read })
|
259
|
+
response.evaluate(@request_signature).body.size.should == 419
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe WebMock::StubRegistry do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
WebMock::StubRegistry.instance.reset!
|
7
|
+
@request_pattern = WebMock::RequestPattern.new(:get, "www.example.com")
|
8
|
+
@request_signature = WebMock::RequestSignature.new(:get, "www.example.com")
|
9
|
+
@request_stub = WebMock::RequestStub.new(:get, "www.example.com")
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "reset!" do
|
13
|
+
before(:each) do
|
14
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should clean request stubs" do
|
18
|
+
WebMock::StubRegistry.instance.registered_request?(@request_signature).should == @request_stub
|
19
|
+
WebMock::StubRegistry.instance.reset!
|
20
|
+
WebMock::StubRegistry.instance.registered_request?(@request_signature).should == nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "registering and reporting registered requests" do
|
25
|
+
|
26
|
+
it "should return registered stub" do
|
27
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub).should == @request_stub
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should report if request stub is not registered" do
|
31
|
+
WebMock::StubRegistry.instance.registered_request?(@request_signature).should == nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should register and report registered stib" do
|
35
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub)
|
36
|
+
WebMock::StubRegistry.instance.registered_request?(@request_signature).should == @request_stub
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "response for request" do
|
43
|
+
|
44
|
+
it "should report registered evaluated response for request pattern" do
|
45
|
+
@request_stub.to_return(:body => "abc")
|
46
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub)
|
47
|
+
WebMock::StubRegistry.instance.response_for_request(@request_signature).
|
48
|
+
should == WebMock::Response.new(:body => "abc")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should report evaluated response" do
|
52
|
+
@request_stub.to_return {|request| {:body => request.method.to_s} }
|
53
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub)
|
54
|
+
response1 = WebMock::StubRegistry.instance.response_for_request(@request_signature)
|
55
|
+
response1.should == WebMock::Response.new(:body => "get")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should report clone of theresponse" do
|
59
|
+
@request_stub.to_return {|request| {:body => request.method.to_s} }
|
60
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub)
|
61
|
+
response1 = WebMock::StubRegistry.instance.response_for_request(@request_signature)
|
62
|
+
response2 = WebMock::StubRegistry.instance.response_for_request(@request_signature)
|
63
|
+
response1.should_not be(response2)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should report nothing if no response for request is registered" do
|
67
|
+
WebMock::StubRegistry.instance.response_for_request(@request_signature).should == nil
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should always return last registered matching response" do
|
71
|
+
@request_stub1 = WebMock::RequestStub.new(:get, "www.example.com")
|
72
|
+
@request_stub1.to_return(:body => "abc")
|
73
|
+
@request_stub2 = WebMock::RequestStub.new(:get, "www.example.com")
|
74
|
+
@request_stub2.to_return(:body => "def")
|
75
|
+
@request_stub3 = WebMock::RequestStub.new(:get, "www.example.org")
|
76
|
+
@request_stub3.to_return(:body => "ghj")
|
77
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub1)
|
78
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub2)
|
79
|
+
WebMock::StubRegistry.instance.register_request_stub(@request_stub3)
|
80
|
+
WebMock::StubRegistry.instance.response_for_request(@request_signature).
|
81
|
+
should == WebMock::Response.new(:body => "def")
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|