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.
Files changed (297) hide show
  1. data/.bundle/config +4 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +23 -0
  4. data/bin/rake +16 -0
  5. data/lib/simple-client/simple-client.rb +229 -0
  6. data/lib/simple-client/version.rb +4 -0
  7. data/lib/simple-client.rb +1 -0
  8. data/test/test_simple-client.rb +236 -0
  9. data/vendor/bundle/ruby/1.8/bin/rake +19 -0
  10. data/vendor/bundle/ruby/1.8/cache/addressable-2.2.8.gem +0 -0
  11. data/vendor/bundle/ruby/1.8/cache/crack-0.3.1.gem +0 -0
  12. data/vendor/bundle/ruby/1.8/cache/rake-0.9.2.2.gem +0 -0
  13. data/vendor/bundle/ruby/1.8/cache/webmock-1.8.8.gem +0 -0
  14. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/CHANGELOG.md +126 -0
  15. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Gemfile +17 -0
  16. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Gemfile.lock +35 -0
  17. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/LICENSE.txt +202 -0
  18. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/README.md +83 -0
  19. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Rakefile +37 -0
  20. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna/native.rb +43 -0
  21. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna/pure.rb +4886 -0
  22. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna.rb +25 -0
  23. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/template.rb +1047 -0
  24. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/uri.rb +2288 -0
  25. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/version.rb +30 -0
  26. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/idna_spec.rb +216 -0
  27. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/net_http_compat_spec.rb +26 -0
  28. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/template_spec.rb +2144 -0
  29. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/uri_spec.rb +4928 -0
  30. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/clobber.rake +2 -0
  31. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/gem.rake +85 -0
  32. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/git.rake +45 -0
  33. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/metrics.rake +22 -0
  34. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/rspec.rake +58 -0
  35. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/rubyforge.rake +89 -0
  36. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/yard.rake +27 -0
  37. data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/website/index.html +110 -0
  38. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/History +25 -0
  39. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/LICENSE +20 -0
  40. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/README.rdoc +42 -0
  41. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/Rakefile +32 -0
  42. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/crack.gemspec +53 -0
  43. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/json.rb +79 -0
  44. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/util.rb +17 -0
  45. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/xml.rb +232 -0
  46. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack.rb +8 -0
  47. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/crack_test.rb +4 -0
  48. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/data/twittersearch-firefox.json +1 -0
  49. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/data/twittersearch-ie.json +1 -0
  50. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/hash_test.rb +28 -0
  51. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/json_test.rb +82 -0
  52. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/parser_test.rb +27 -0
  53. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/string_test.rb +31 -0
  54. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/test_helper.rb +12 -0
  55. data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/xml_test.rb +499 -0
  56. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/CHANGES +522 -0
  57. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/MIT-LICENSE +21 -0
  58. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/README.rdoc +197 -0
  59. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/Rakefile +369 -0
  60. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/TODO +20 -0
  61. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/bin/rake +33 -0
  62. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/command_line_usage.rdoc +114 -0
  63. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/Rakefile1 +38 -0
  64. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/Rakefile2 +35 -0
  65. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/a.c +6 -0
  66. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/b.c +6 -0
  67. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/main.c +11 -0
  68. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/glossary.rdoc +51 -0
  69. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/jamis.rb +591 -0
  70. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/proto_rake.rdoc +127 -0
  71. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rake.1.gz +0 -0
  72. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rakefile.rdoc +557 -0
  73. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rational.rdoc +151 -0
  74. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
  75. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
  76. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
  77. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
  78. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
  79. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
  80. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
  81. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
  82. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
  83. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
  84. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
  85. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
  86. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
  87. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
  88. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
  89. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.6.rdoc +55 -0
  90. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
  91. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
  92. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
  93. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
  94. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/install.rb +90 -0
  95. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/alt_system.rb +109 -0
  96. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb +595 -0
  97. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/classic_namespace.rb +11 -0
  98. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/clean.rb +32 -0
  99. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/cloneable.rb +25 -0
  100. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/compositepublisher.rb +21 -0
  101. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/ftptools.rb +150 -0
  102. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/publisher.rb +73 -0
  103. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/rubyforgepublisher.rb +16 -0
  104. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb +50 -0
  105. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sys.rb +191 -0
  106. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/default_loader.rb +10 -0
  107. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb +176 -0
  108. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/early_time.rb +18 -0
  109. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/core.rb +27 -0
  110. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb +39 -0
  111. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/string.rb +167 -0
  112. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/time.rb +14 -0
  113. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_creation_task.rb +24 -0
  114. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_list.rb +403 -0
  115. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_task.rb +47 -0
  116. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_utils.rb +114 -0
  117. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb +145 -0
  118. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/gempackagetask.rb +15 -0
  119. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/invocation_chain.rb +51 -0
  120. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/invocation_exception_mixin.rb +16 -0
  121. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/loaders/makefile.rb +40 -0
  122. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/multi_task.rb +16 -0
  123. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/name_space.rb +25 -0
  124. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/packagetask.rb +185 -0
  125. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/pathmap.rb +1 -0
  126. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/pseudo_status.rb +24 -0
  127. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb +29 -0
  128. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb +22 -0
  129. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb +234 -0
  130. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ruby182_test_unit_fix.rb +25 -0
  131. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
  132. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/runtest.rb +21 -0
  133. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb +327 -0
  134. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_argument_error.rb +7 -0
  135. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_arguments.rb +78 -0
  136. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_manager.rb +307 -0
  137. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/tasklib.rb +22 -0
  138. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/testtask.rb +191 -0
  139. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/version.rb +8 -0
  140. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/win32.rb +55 -0
  141. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake.rb +69 -0
  142. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/file_creation.rb +34 -0
  143. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/helper.rb +492 -0
  144. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake.rb +40 -0
  145. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_application.rb +489 -0
  146. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_application_options.rb +335 -0
  147. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_clean.rb +14 -0
  148. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_definitions.rb +80 -0
  149. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_directory_task.rb +46 -0
  150. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_dsl.rb +77 -0
  151. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_early_time.rb +31 -0
  152. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_extension.rb +59 -0
  153. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_creation_task.rb +56 -0
  154. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_list.rb +628 -0
  155. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_list_path_map.rb +8 -0
  156. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_task.rb +102 -0
  157. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_utils.rb +305 -0
  158. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb +59 -0
  159. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_functional.rb +450 -0
  160. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_invocation_chain.rb +52 -0
  161. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_makefile_loader.rb +44 -0
  162. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_multi_task.rb +51 -0
  163. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_name_space.rb +43 -0
  164. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_package_task.rb +79 -0
  165. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map.rb +157 -0
  166. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map_explode.rb +34 -0
  167. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map_partial.rb +18 -0
  168. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_pseudo_status.rb +21 -0
  169. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rake_test_loader.rb +21 -0
  170. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rdoc_task.rb +83 -0
  171. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_require.rb +40 -0
  172. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rules.rb +327 -0
  173. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task.rb +267 -0
  174. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_argument_parsing.rb +103 -0
  175. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_arguments.rb +88 -0
  176. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_lib.rb +9 -0
  177. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_manager.rb +157 -0
  178. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_manager_argument_resolution.rb +36 -0
  179. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_with_arguments.rb +173 -0
  180. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_test_task.rb +120 -0
  181. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_top_level_functions.rb +111 -0
  182. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_win32.rb +72 -0
  183. data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_sys.rb +20 -0
  184. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/CHANGELOG.md +749 -0
  185. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Gemfile +21 -0
  186. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Guardfile +24 -0
  187. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/LICENSE +20 -0
  188. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/README.md +728 -0
  189. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Rakefile +65 -0
  190. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/api.rb +63 -0
  191. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/assertion_failure.rb +11 -0
  192. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/callback_registry.rb +35 -0
  193. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/config.rb +10 -0
  194. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/cucumber.rb +8 -0
  195. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/deprecation.rb +9 -0
  196. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/errors.rb +33 -0
  197. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/curb_adapter.rb +287 -0
  198. 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
  199. 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
  200. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +11 -0
  201. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/excon_adapter.rb +95 -0
  202. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
  203. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
  204. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/httpclient_adapter.rb +193 -0
  205. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/net_http.rb +279 -0
  206. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
  207. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/patron_adapter.rb +129 -0
  208. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +180 -0
  209. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/matchers/hash_including_matcher.rb +25 -0
  210. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/minitest.rb +15 -0
  211. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rack_response.rb +63 -0
  212. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_execution_verifier.rb +56 -0
  213. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_pattern.rb +282 -0
  214. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_registry.rb +35 -0
  215. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_signature.rb +50 -0
  216. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_stub.rb +97 -0
  217. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/response.rb +144 -0
  218. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/responses_sequence.rb +40 -0
  219. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers/request_pattern_matcher.rb +42 -0
  220. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers/webmock_matcher.rb +46 -0
  221. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers.rb +28 -0
  222. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec.rb +33 -0
  223. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/stub_registry.rb +61 -0
  224. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/stub_request_snippet.rb +30 -0
  225. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/test_unit.rb +20 -0
  226. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/hash_counter.rb +25 -0
  227. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/hash_keys_stringifier.rb +23 -0
  228. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/headers.rb +43 -0
  229. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/json.rb +54 -0
  230. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/uri.rb +101 -0
  231. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/version_checker.rb +73 -0
  232. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/version.rb +3 -0
  233. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/webmock.rb +124 -0
  234. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock.rb +49 -0
  235. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/test_helper.rb +29 -0
  236. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/test_webmock.rb +6 -0
  237. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/webmock_spec.rb +50 -0
  238. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/curb/curb_spec.rb +340 -0
  239. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/curb/curb_spec_helper.rb +144 -0
  240. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/em_http_request/em_http_request_spec.rb +183 -0
  241. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +72 -0
  242. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/excon/excon_spec.rb +15 -0
  243. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/excon/excon_spec_helper.rb +38 -0
  244. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/httpclient/httpclient_spec.rb +76 -0
  245. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/httpclient/httpclient_spec_helper.rb +48 -0
  246. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_shared.rb +125 -0
  247. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec.rb +255 -0
  248. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec_helper.rb +55 -0
  249. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
  250. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/patron/patron_spec.rb +136 -0
  251. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/patron/patron_spec_helper.rb +50 -0
  252. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +142 -0
  253. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/callbacks.rb +146 -0
  254. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
  255. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
  256. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
  257. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/request_expectations.rb +666 -0
  258. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/returning_declared_responses.rb +367 -0
  259. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/stubbing_requests.rb +447 -0
  260. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +74 -0
  261. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +56 -0
  262. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/webmock_shared.rb +41 -0
  263. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/quality_spec.rb +60 -0
  264. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/spec_helper.rb +57 -0
  265. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/example_curl_output.txt +22 -0
  266. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/my_rack_app.rb +48 -0
  267. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/network_connection.rb +25 -0
  268. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/webmock_server.rb +65 -0
  269. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/errors_spec.rb +32 -0
  270. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
  271. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
  272. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/rack_response_spec.rb +74 -0
  273. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_execution_verifier_spec.rb +100 -0
  274. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_pattern_spec.rb +479 -0
  275. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_registry_spec.rb +75 -0
  276. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_signature_spec.rb +113 -0
  277. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_stub_spec.rb +198 -0
  278. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/response_spec.rb +267 -0
  279. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/stub_registry_spec.rb +86 -0
  280. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/stub_request_snippet_spec.rb +95 -0
  281. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/hash_counter_spec.rb +39 -0
  282. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
  283. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/headers_spec.rb +28 -0
  284. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/json_spec.rb +7 -0
  285. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/uri_spec.rb +257 -0
  286. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/version_checker_spec.rb +59 -0
  287. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/webmock_spec.rb +7 -0
  288. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/http_request.rb +24 -0
  289. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/shared_test.rb +76 -0
  290. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/test_helper.rb +23 -0
  291. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/test_webmock.rb +6 -0
  292. data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/webmock.gemspec +35 -0
  293. data/vendor/bundle/ruby/1.8/specifications/addressable-2.2.8.gemspec +38 -0
  294. data/vendor/bundle/ruby/1.8/specifications/crack-0.3.1.gemspec +25 -0
  295. data/vendor/bundle/ruby/1.8/specifications/rake-0.9.2.2.gemspec +33 -0
  296. data/vendor/bundle/ruby/1.8/specifications/webmock-1.8.8.gemspec +61 -0
  297. metadata +390 -0
@@ -0,0 +1,479 @@
1
+ require 'spec_helper'
2
+
3
+ describe WebMock::RequestPattern do
4
+
5
+ describe "describing itself" do
6
+ it "should report string describing itself" do
7
+ WebMock::RequestPattern.new(:get, "www.example.com",
8
+ :body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).to_s.should ==
9
+ "GET http://www.example.com/ with body \"abc\" with headers {'A'=>'a', 'B'=>'b'}"
10
+ end
11
+
12
+ it "should report string describing itself with block" do
13
+ WebMock::RequestPattern.new(:get, "www.example.com",
14
+ :body => "abc", :headers => {'A' => 'a', 'B' => 'b'}).with {|req| true}.to_s.should ==
15
+ "GET http://www.example.com/ with body \"abc\" with headers {'A'=>'a', 'B'=>'b'} with given block"
16
+ end
17
+
18
+ it "should report string describing itself with query params" do
19
+ WebMock::RequestPattern.new(:get, /.*example.*/, :query => {'a' => ['b', 'c']}).to_s.should ==
20
+ "GET /.*example.*/ with query params {\"a\"=>[\"b\", \"c\"]}"
21
+ end
22
+
23
+ it "should report string describing itself with query params as hash including matcher" do
24
+ WebMock::RequestPattern.new(:get, /.*example.*/,
25
+ :query => WebMock::Matchers::HashIncludingMatcher.new({'a' => ['b', 'c']})).to_s.should ==
26
+ "GET /.*example.*/ with query params hash_including({\"a\"=>[\"b\", \"c\"]})"
27
+ end
28
+
29
+ it "should report string describing itself with body as hash including matcher" do
30
+ WebMock::RequestPattern.new(:get, /.*example.*/,
31
+ :body => WebMock::Matchers::HashIncludingMatcher.new({'a' => ['b', 'c']})).to_s.should ==
32
+ "GET /.*example.*/ with body hash_including({\"a\"=>[\"b\", \"c\"]})"
33
+ end
34
+ end
35
+
36
+ describe "with" do
37
+ before(:each) do
38
+ @request_pattern =WebMock::RequestPattern.new(:get, "www.example.com")
39
+ end
40
+
41
+ it "should have assigned body pattern" do
42
+ @request_pattern.with(:body => "abc")
43
+ @request_pattern.to_s.should ==WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").to_s
44
+ end
45
+
46
+ it "should have assigned normalized headers pattern" do
47
+ @request_pattern.with(:headers => {'A' => 'a'})
48
+ @request_pattern.to_s.should ==WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A' => 'a'}).to_s
49
+ end
50
+
51
+ end
52
+
53
+
54
+ class WebMock::RequestPattern
55
+ def match(request_signature)
56
+ self.matches?(request_signature)
57
+ end
58
+ end
59
+
60
+ describe "when matching" do
61
+
62
+ it "should match if uri matches and method matches" do
63
+ WebMock::RequestPattern.new(:get, "www.example.com").
64
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
65
+ end
66
+
67
+ it "should match if uri matches and method pattern is any" do
68
+ WebMock::RequestPattern.new(:any, "www.example.com").
69
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
70
+ end
71
+
72
+ it "should not match if request has different method" do
73
+ WebMock::RequestPattern.new(:post, "www.example.com").
74
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
75
+ end
76
+
77
+ it "should match if uri matches request uri" do
78
+ WebMock::RequestPattern.new(:get, "www.example.com").
79
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
80
+ end
81
+
82
+ it "should match if request has unescaped uri" do
83
+ WebMock::RequestPattern.new(:get, "www.example.com/my%20path").
84
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/my path"))
85
+ end
86
+
87
+ it "should match if request has escaped uri" do
88
+ WebMock::RequestPattern.new(:get, "www.example.com/my path").
89
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
90
+ end
91
+
92
+ it "should match if uri regexp pattern matches unescaped form of request uri" do
93
+ WebMock::RequestPattern.new(:get, /.*my path.*/).
94
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/my%20path"))
95
+ end
96
+
97
+ it "should match if uri regexp pattern matches request uri" do
98
+ WebMock::RequestPattern.new(:get, /.*example.*/).
99
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
100
+ end
101
+
102
+ it "should match for uris with same parameters as pattern" do
103
+ WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2").
104
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
105
+ end
106
+
107
+ it "should not match for uris with different parameters" do
108
+ WebMock::RequestPattern.new(:get, "www.example.com?a=1&b=2").
109
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a=2&b=1"))
110
+ end
111
+
112
+ it "should match for uri parameters in different order" do
113
+ WebMock::RequestPattern.new(:get, "www.example.com?b=2&a=1").
114
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a=1&b=2"))
115
+ end
116
+
117
+ describe "when parameters are escaped" do
118
+
119
+ it "should match if uri pattern has escaped parameters and request has unescaped parameters" do
120
+ WebMock::RequestPattern.new(:get, "www.example.com/?a=a%20b").
121
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
122
+ end
123
+
124
+ it "should match if uri pattern has unescaped parameters and request has escaped parameters" do
125
+ WebMock::RequestPattern.new(:get, "www.example.com/?a=a b").
126
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
127
+ end
128
+
129
+ it "should match if uri regexp pattern matches uri with unescaped parameters and request has escaped parameters" do
130
+ WebMock::RequestPattern.new(:get, /.*a=a b.*/).
131
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a%20b"))
132
+ end
133
+
134
+ it "should match if uri regexp pattern matches uri with escaped parameters and request has unescaped parameters" do
135
+ WebMock::RequestPattern.new(:get, /.*a=a%20b.*/).
136
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?a=a b"))
137
+ end
138
+
139
+ end
140
+
141
+ describe "when matching requests on query params" do
142
+
143
+ describe "when uri is described as regexp" do
144
+ it "should match request query params" do
145
+ WebMock::RequestPattern.new(:get, /.*example.*/, :query => {"a" => ["b", "c"]}).
146
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
147
+ end
148
+
149
+ it "should match request query params if params don't match" do
150
+ WebMock::RequestPattern.new(:get, /.*example.*/, :query => {"x" => ["b", "c"]}).
151
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
152
+ end
153
+
154
+ it "should match when query params are declared as HashIncluding matcher matching params" do
155
+ WebMock::RequestPattern.new(:get, /.*example.*/,
156
+ :query => WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]})).
157
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
158
+ end
159
+
160
+ it "should not match when query params are declared as HashIncluding matcher not matching params" do
161
+ WebMock::RequestPattern.new(:get, /.*example.*/,
162
+ :query => WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]})).
163
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
164
+ end
165
+
166
+ it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
167
+ WebMock::RequestPattern.new(:get, /.*example.*/,
168
+ :query => RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]})).
169
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
170
+ end
171
+
172
+ it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
173
+ WebMock::RequestPattern.new(:get, /.*example.*/,
174
+ :query => RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]})).
175
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
176
+ end
177
+ end
178
+
179
+ describe "when uri is described as string" do
180
+ it "should match when query params are the same as declared in hash" do
181
+ WebMock::RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
182
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
183
+ end
184
+
185
+ it "should not match when query params are different than the declared in hash" do
186
+ WebMock::RequestPattern.new(:get, "www.example.com", :query => {"a" => ["b", "c"]}).
187
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?x[]=b&a[]=c"))
188
+ end
189
+
190
+ it "should match when query params are the same as declared as string" do
191
+ WebMock::RequestPattern.new(:get, "www.example.com", :query => "a[]=b&a[]=c").
192
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c"))
193
+ end
194
+
195
+ it "should match when query params are the same as declared both in query option or url" do
196
+ WebMock::RequestPattern.new(:get, "www.example.com/?x=3", :query => "a[]=b&a[]=c").
197
+ should match(WebMock::RequestSignature.new(:get, "www.example.com/?x=3&a[]=b&a[]=c"))
198
+ end
199
+
200
+ it "should match when query params are declared as HashIncluding matcher matching params" do
201
+ WebMock::RequestPattern.new(:get, "www.example.com",
202
+ :query => WebMock::Matchers::HashIncludingMatcher.new({"a" => ["b", "c"]})).
203
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
204
+ end
205
+
206
+ it "should not match when query params are declared as HashIncluding matcher not matching params" do
207
+ WebMock::RequestPattern.new(:get, "www.example.com",
208
+ :query => WebMock::Matchers::HashIncludingMatcher.new({"x" => ["b", "c"]})).
209
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
210
+ end
211
+
212
+ it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
213
+ WebMock::RequestPattern.new(:get, "www.example.com",
214
+ :query => RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "c"]})).
215
+ should match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
216
+ end
217
+
218
+ it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
219
+ WebMock::RequestPattern.new(:get, "www.example.com",
220
+ :query => RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({"a" => ["b", "d"]})).
221
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com?a[]=b&a[]=c&b=1"))
222
+ end
223
+ end
224
+ end
225
+
226
+ describe "when matching requests with body" do
227
+
228
+ it "should match if request body and body pattern are the same" do
229
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").
230
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
231
+ end
232
+
233
+ it "should match if request body matches regexp" do
234
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => /^abc$/).
235
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
236
+ end
237
+
238
+ it "should not match if body pattern is different than request body" do
239
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "def").
240
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
241
+ end
242
+
243
+ it "should not match if request body doesn't match regexp pattern" do
244
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => /^abc$/).
245
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "xabc"))
246
+ end
247
+
248
+ it "should match if pattern doesn't have specified body" do
249
+ WebMock::RequestPattern.new(:get, "www.example.com").
250
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
251
+ end
252
+
253
+ it "should not match if pattern has body specified as nil but request body is not empty" do
254
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => nil).
255
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
256
+ end
257
+
258
+ it "should not match if pattern has empty body but request body is not empty" do
259
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "").
260
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :body => "abc"))
261
+ end
262
+
263
+ it "should not match if pattern has body specified but request has no body" do
264
+ WebMock::RequestPattern.new(:get, "www.example.com", :body => "abc").
265
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
266
+ end
267
+
268
+ describe "when body in pattern is declared as a hash" do
269
+ let(:body_hash) { {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}} }
270
+
271
+ describe "for request with url encoded body" do
272
+ it "should match when hash matches body" do
273
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
274
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&c[d][]=f&b=five'))
275
+ end
276
+
277
+ it "should match when hash matches body in different order of params" do
278
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
279
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&b=five&c[d][]=f'))
280
+ end
281
+
282
+ it "should not match when hash doesn't match url encoded body" do
283
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
284
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'c[d][]=f&a=1&c[d][]=e'))
285
+ end
286
+
287
+ it "should not match when body is not url encoded" do
288
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
289
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'foo bar'))
290
+ end
291
+
292
+ it "should match when hash contains regex values" do
293
+ WebMock::RequestPattern.new(:post, "www.example.com", :body => {:a => /^\w{5}$/, :b => {:c => /^\d{3}$/}}).
294
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=abcde&b[c]=123'))
295
+ end
296
+
297
+ it "should not match when hash does not contains regex values" do
298
+ WebMock::RequestPattern.new(:post, "www.example.com", :body => {:a => /^\d+$/, :b => {:c => /^\d{3}$/}}).
299
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=abcde&b[c]=123'))
300
+ end
301
+ end
302
+
303
+ describe "for request with json body and content type is set to json" do
304
+ it "should match when hash matches body" do
305
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
306
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/json'},
307
+ :body => "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}"))
308
+ end
309
+
310
+ it "should match if hash matches body in different form" do
311
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
312
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/json'},
313
+ :body => "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}"))
314
+ end
315
+
316
+ it "should not match when body is not json" do
317
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
318
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
319
+ :headers => {:content_type => 'application/json'}, :body => "foo bar"))
320
+ end
321
+
322
+ it "shound not match if request body is different" do
323
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => {:a => 1, :b => 2}).
324
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
325
+ :headers => {:content_type => 'application/json'}, :body => "{\"a\":1,\"c\":null}"))
326
+ end
327
+
328
+ it "should not match if request body is has less params than pattern" do
329
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => {:a => 1, :b => 2}).
330
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
331
+ :headers => {:content_type => 'application/json'}, :body => "{\"a\":1}"))
332
+ end
333
+
334
+ it "should not match if request body is has more params than pattern" do
335
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => {:a => 1}).
336
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
337
+ :headers => {:content_type => 'application/json'}, :body => "{\"a\":1,\"c\":1}"))
338
+ end
339
+ end
340
+
341
+ describe "for request with xml body and content type is set to xml" do
342
+ let(:body_hash) { {"opt" => {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}}} }
343
+
344
+ it "should match when hash matches body" do
345
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
346
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml'},
347
+ :body => "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
348
+ end
349
+
350
+ it "should match if hash matches body in different form" do
351
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
352
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml'},
353
+ :body => "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
354
+ end
355
+
356
+ it "should not match when body is not xml" do
357
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
358
+ should_not match(WebMock::RequestSignature.new(:post, "www.example.com",
359
+ :headers => {:content_type => 'application/xml'}, :body => "foo bar"))
360
+ end
361
+
362
+ it "matches when the content type include a charset" do
363
+ WebMock::RequestPattern.new(:post, 'www.example.com', :body => body_hash).
364
+ should match(WebMock::RequestSignature.new(:post, "www.example.com", :headers => {:content_type => 'application/xml;charset=UTF-8'},
365
+ :body => "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n"))
366
+
367
+ end
368
+ end
369
+ end
370
+
371
+ describe "when body in a pattern is declared as a partial hash matcher" do
372
+ let(:signature) { WebMock::RequestSignature.new(:post, "www.example.com", :body => 'a=1&c[d][]=e&c[d][]=f&b=five') }
373
+
374
+ it "should match when query params are declared as HashIncluding matcher matching params" do
375
+ WebMock::RequestPattern.new(:post, "www.example.com",
376
+ :body => WebMock::Matchers::HashIncludingMatcher.new({:a => '1', 'c' => {'d' => ['e', 'f']}})).
377
+ should match(signature)
378
+ end
379
+
380
+ it "should not match when query params are declared as HashIncluding matcher not matching params" do
381
+ WebMock::RequestPattern.new(:post, "www.example.com",
382
+ :body => WebMock::Matchers::HashIncludingMatcher.new({:x => '1', 'c' => {'d' => ['e', 'f']}})).
383
+ should_not match(signature)
384
+ end
385
+
386
+ it "should match when query params are declared as RSpec HashIncluding matcher matching params" do
387
+ WebMock::RequestPattern.new(:post, "www.example.com",
388
+ :body => RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({:a => '1', 'c' => {'d' => ['e', 'f']}})).
389
+ should match(signature)
390
+ end
391
+
392
+ it "should not match when query params are declared as RSpec HashIncluding matcher not matching params" do
393
+ WebMock::RequestPattern.new(:post, "www.example.com",
394
+ :body => RSpec::Mocks::ArgumentMatchers::HashIncludingMatcher.new({:x => '1', 'c' => {'d' => ['e', 'f']}})).
395
+ should_not match(signature)
396
+ end
397
+ end
398
+ end
399
+
400
+ it "should match if pattern and request have the same headers" do
401
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}).
402
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
403
+ end
404
+
405
+ it "should match if pattern headers values are regexps matching request header values" do
406
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => %r{^image/jpeg$}}).
407
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
408
+ end
409
+
410
+ it "should not match if pattern has different value of header than request" do
411
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/png'}).
412
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
413
+ end
414
+
415
+ it "should not match if pattern header value regexp doesn't match request header value" do
416
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => %r{^image\/jpeg$}}).
417
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpegx'}))
418
+ end
419
+
420
+ it "should match if request has more headers than request pattern" do
421
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}).
422
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}))
423
+ end
424
+
425
+ it "should not match if request has less headers than the request pattern" do
426
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg', 'Content-Length' => '8888'}).
427
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'Content-Type' => 'image/jpeg'}))
428
+ end
429
+
430
+ it "should match even is header keys are declared in different form" do
431
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'ContentLength' => '8888', 'Content-type' => 'image/png'}).
432
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {:ContentLength => 8888, 'content_type' => 'image/png'}))
433
+ end
434
+
435
+ it "should match is pattern doesn't have specified headers" do
436
+ WebMock::RequestPattern.new(:get, "www.example.com").
437
+ should match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
438
+ end
439
+
440
+ it "should not match if pattern has nil headers but request has headers" do
441
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => nil).
442
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
443
+ end
444
+
445
+ it "should not match if pattern has empty headers but request has headers" do
446
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {}).
447
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {'A' => 'a'}))
448
+ end
449
+
450
+ it "should not match if pattern has specified headers but request has nil headers" do
451
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A'=>'a'}).
452
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
453
+ end
454
+
455
+ it "should not match if pattern has specified headers but request has empty headers" do
456
+ WebMock::RequestPattern.new(:get, "www.example.com", :headers => {'A'=>'a'}).
457
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com", :headers => {}))
458
+ end
459
+
460
+ it "should match if block given in pattern evaluates request to true" do
461
+ WebMock::RequestPattern.new(:get, "www.example.com").with { |request| true }.
462
+ should match(WebMock::RequestSignature.new(:get, "www.example.com"))
463
+ end
464
+
465
+ it "should not match if block given in pattrn evaluates request to false" do
466
+ WebMock::RequestPattern.new(:get, "www.example.com").with { |request| false }.
467
+ should_not match(WebMock::RequestSignature.new(:get, "www.example.com"))
468
+ end
469
+
470
+ it "should yield block with request signature" do
471
+ signature = WebMock::RequestSignature.new(:get, "www.example.com")
472
+ WebMock::RequestPattern.new(:get, "www.example.com").with { |request| request == signature }.
473
+ should match(signature)
474
+ end
475
+
476
+ end
477
+
478
+
479
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ describe WebMock::RequestRegistry do
4
+
5
+ before(:each) do
6
+ WebMock::RequestRegistry.instance.reset!
7
+ @request_pattern = WebMock::RequestPattern.new(:get, "www.example.com")
8
+ @request_signature = WebMock::RequestSignature.new(:get, "www.example.com")
9
+ end
10
+
11
+ describe "reset!" do
12
+ before(:each) do
13
+ WebMock::RequestRegistry.instance.requested_signatures.put(@request_signature)
14
+ end
15
+
16
+ it "should clean list of executed requests" do
17
+ WebMock::RequestRegistry.instance.times_executed(@request_pattern).should == 1
18
+ WebMock::RequestRegistry.instance.reset!
19
+ WebMock::RequestRegistry.instance.times_executed(@request_pattern).should == 0
20
+ end
21
+
22
+ end
23
+
24
+ describe "times executed" do
25
+
26
+ before(:each) do
27
+ @request_stub1 = WebMock::RequestStub.new(:get, "www.example.com")
28
+ @request_stub2 = WebMock::RequestStub.new(:get, "www.example.net")
29
+ @request_stub3 = WebMock::RequestStub.new(:get, "www.example.org")
30
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.com"))
31
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.com"))
32
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.org"))
33
+ end
34
+
35
+ it "should report 0 if no request matching pattern was requested" do
36
+ WebMock::RequestRegistry.instance.times_executed(WebMock::RequestPattern.new(:get, "www.example.net")).should == 0
37
+ end
38
+
39
+ it "should report number of times matching pattern was requested" do
40
+ WebMock::RequestRegistry.instance.times_executed(WebMock::RequestPattern.new(:get, "www.example.com")).should == 2
41
+ end
42
+
43
+ it "should report number of times all matching pattern were requested" do
44
+ WebMock::RequestRegistry.instance.times_executed(WebMock::RequestPattern.new(:get, /.*example.*/)).should == 3
45
+ end
46
+ end
47
+
48
+ describe "request_signatures" do
49
+ it "should return hash of unique request signatures with accumulated number" do
50
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.com"))
51
+ WebMock::RequestRegistry.instance.requested_signatures.put(WebMock::RequestSignature.new(:get, "www.example.com"))
52
+ WebMock::RequestRegistry.instance.requested_signatures.
53
+ get(WebMock::RequestSignature.new(:get, "www.example.com")).should == 2
54
+ end
55
+ end
56
+
57
+ describe "to_s" do
58
+ it "should output string with all executed requests and numbers of executions" do
59
+ [
60
+ WebMock::RequestSignature.new(:get, "www.example.com"),
61
+ WebMock::RequestSignature.new(:get, "www.example.com"),
62
+ WebMock::RequestSignature.new(:put, "www.example.org"),
63
+ ].each do |s|
64
+ WebMock::RequestRegistry.instance.requested_signatures.put(s)
65
+ end
66
+ WebMock::RequestRegistry.instance.to_s.should ==
67
+ "GET http://www.example.com/ was made 2 times\nPUT http://www.example.org/ was made 1 time\n"
68
+ end
69
+
70
+ it "should output info if no requests were executed" do
71
+ WebMock::RequestRegistry.instance.to_s.should == "No requests were made."
72
+ end
73
+ end
74
+
75
+ end