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,666 @@
1
+ shared_context "request expectations" do |*adapter_info|
2
+ describe "when request expectations are set" do
3
+ describe "when net connect is not allowed" do
4
+ before(:each) do
5
+ WebMock.disable_net_connect!
6
+ stub_request(:any, "http://www.example.com")
7
+ stub_request(:any, "https://www.example.com")
8
+ end
9
+
10
+ it "should satisfy expectation if request was executed with the same uri and method" do
11
+ lambda {
12
+ http_request(:get, "http://www.example.com/")
13
+ a_request(:get, "http://www.example.com").should have_been_made.once
14
+ }.should_not raise_error
15
+ end
16
+
17
+ it "should satisfy expectation declared on WebMock.resuest" do
18
+ lambda {
19
+ http_request(:get, "http://www.example.com/")
20
+ WebMock.request(:get, "http://www.example.com").should have_been_made.once
21
+ }.should_not raise_error
22
+ end
23
+
24
+ it "should satisfy expectation if request was not expected and not executed" do
25
+ lambda {
26
+ a_request(:get, "http://www.example.com").should_not have_been_made
27
+ }.should_not raise_error
28
+ end
29
+
30
+ it "should fail if request was not expected but executed" do
31
+ lambda {
32
+ http_request(:get, "http://www.example.com/")
33
+ a_request(:get, "http://www.example.com").should_not have_been_made
34
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time))
35
+ end
36
+
37
+ it "should fail resulting with failure with a message and executed requests listed" do
38
+ lambda {
39
+ http_request(:get, "http://www.example.com/")
40
+ a_request(:get, "http://www.example.com").should_not have_been_made
41
+ }.should fail_with(%r{The following requests were made:\n\nGET http://www.example.com/.+was made 1 time})
42
+ end
43
+
44
+ it "should fail if request was not executed" do
45
+ lambda {
46
+ a_request(:get, "http://www.example.com").should have_been_made
47
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times))
48
+ end
49
+
50
+ it "should fail if request was executed to different uri" do
51
+ lambda {
52
+ http_request(:get, "http://www.example.com/")
53
+ a_request(:get, "http://www.example.org").should have_been_made
54
+ }.should fail_with(%r(The request GET http://www.example.org/ was expected to execute 1 time but it executed 0 times))
55
+ end
56
+
57
+ it "should fail if request was executed with different method" do
58
+ lambda {
59
+ http_request(:post, "http://www.example.com/", :body => "abc")
60
+ a_request(:get, "http://www.example.com").should have_been_made
61
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times))
62
+ end
63
+
64
+ it "should satisfy expectation if request was executed with different form of uri" do
65
+ lambda {
66
+ http_request(:get, "http://www.example.com/")
67
+ a_request(:get, "www.example.com").should have_been_made
68
+ }.should_not raise_error
69
+ end
70
+
71
+ it "should satisfy expectation if request was executed with different form of uri without port " do
72
+ lambda {
73
+ http_request(:get, "http://www.example.com/")
74
+ a_request(:get, "www.example.com:80").should have_been_made
75
+ }.should_not raise_error
76
+ end
77
+
78
+ it "should satisfy expectation if request was executed with different form of uri with port" do
79
+ lambda {
80
+ http_request(:get, "http://www.example.com/")
81
+ a_request(:get, "www.example.com:80").should have_been_made
82
+ }.should_not raise_error
83
+ end
84
+
85
+ it "should fail if request was executed to a different port" do
86
+ lambda {
87
+ http_request(:get, "http://www.example.com:80/")
88
+ a_request(:get, "www.example.com:90").should have_been_made
89
+ }.should fail_with(%r(The request GET http://www.example.com:90/ was expected to execute 1 time but it executed 0 times))
90
+ end
91
+
92
+ it "should satisfy expectation if request was executed with different form of uri with https port" do
93
+ lambda {
94
+ http_request(:get, "https://www.example.com/")
95
+ a_request(:get, "https://www.example.com:443/").should have_been_made
96
+ }.should_not raise_error
97
+ end
98
+
99
+ describe "when matching requests with escaped or unescaped uris" do
100
+ before(:each) do
101
+ WebMock.disable_net_connect!
102
+ stub_request(:any, "http://www.example.com/?#{NOT_ESCAPED_PARAMS}")
103
+ end
104
+
105
+ it "should satisfy expectation if request was executed with escaped params" do
106
+ lambda {
107
+ http_request(:get, "http://www.example.com/?#{ESCAPED_PARAMS}")
108
+ a_request(:get, "http://www.example.com/?#{NOT_ESCAPED_PARAMS}").should have_been_made
109
+ }.should_not raise_error
110
+ end
111
+
112
+ it "should satisfy expectation if request was executed with non escaped params" do
113
+ lambda {
114
+ http_request(:get, "http://www.example.com/?#{NOT_ESCAPED_PARAMS}")
115
+ a_request(:get, "http://www.example.com/?#{ESCAPED_PARAMS}").should have_been_made
116
+ }.should_not raise_error
117
+ end
118
+
119
+ it "should satisfy expectation if request was executed with escaped params and uri matching regexp was expected" do
120
+ lambda {
121
+ http_request(:get, "http://www.example.com/?#{ESCAPED_PARAMS}")
122
+ a_request(:get, /.*example.*/).should have_been_made
123
+ }.should_not raise_error
124
+ end
125
+
126
+ end
127
+
128
+ describe "when matching requests with query params" do
129
+ before(:each) do
130
+ stub_request(:any, /.*example.*/)
131
+ end
132
+
133
+ it "should satisfy expectation if the request was executed with query params declared as a hash in a query option" do
134
+ lambda {
135
+ http_request(:get, "http://www.example.com/?a[]=b&a[]=c")
136
+ a_request(:get, "www.example.com").with(:query => {"a" => ["b", "c"]}).should have_been_made
137
+ }.should_not raise_error
138
+ end
139
+
140
+ it "should satisfy expectation if the request was executed with query params declared as string in query option" do
141
+ lambda {
142
+ http_request(:get, "http://www.example.com/?a[]=b&a[]=c")
143
+ a_request(:get, "www.example.com").with(:query => "a[]=b&a[]=c").should have_been_made
144
+ }.should_not raise_error
145
+ end
146
+
147
+ it "should satisfy expectation if the request was executed with query params both in uri and in query option" do
148
+ lambda {
149
+ http_request(:get, "http://www.example.com/?x=3&a[]=b&a[]=c")
150
+ a_request(:get, "www.example.com/?x=3").with(:query => {"a" => ["b", "c"]}).should have_been_made
151
+ }.should_not raise_error
152
+ end
153
+
154
+ it "should satisfy expectation if the request was executed with only part query params declared as a hash in a query option" do
155
+ lambda {
156
+ http_request(:get, "http://www.example.com/?a[]=b&a[]=c&b=1")
157
+ a_request(:get, "www.example.com").with(:query => hash_including({"a" => ["b", "c"]})).should have_been_made
158
+ }.should_not raise_error
159
+ end
160
+ end
161
+
162
+ it "should fail if request was made more times than expected" do
163
+ lambda {
164
+ http_request(:get, "http://www.example.com/")
165
+ http_request(:get, "http://www.example.com/")
166
+ a_request(:get, "http://www.example.com").should have_been_made
167
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 1 time but it executed 2 times))
168
+ end
169
+
170
+ it "should fail if request was made less times than expected" do
171
+ lambda {
172
+ http_request(:get, "http://www.example.com/")
173
+ a_request(:get, "http://www.example.com").should have_been_made.twice
174
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 2 times but it executed 1 time))
175
+ end
176
+
177
+ it "should fail if request was made less times than expected when 3 times expected" do
178
+ lambda {
179
+ http_request(:get, "http://www.example.com/")
180
+ a_request(:get, "http://www.example.com").should have_been_made.times(3)
181
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 3 times but it executed 1 time))
182
+ end
183
+
184
+ it "should satisfy expectation if request was executed with the same body" do
185
+ lambda {
186
+ http_request(:post, "http://www.example.com/", :body => "abc")
187
+ a_request(:post, "www.example.com").with(:body => "abc").should have_been_made
188
+ }.should_not raise_error
189
+ end
190
+
191
+ it "should fail if request was executed with different body" do
192
+ lambda {
193
+ http_request(:post, "http://www.example.com/", :body => "abc")
194
+ a_request(:post, "www.example.com").
195
+ with(:body => "def").should have_been_made
196
+ }.should fail_with(%r(The request POST http://www.example.com/ with body "def" was expected to execute 1 time but it executed 0 times))
197
+ end
198
+
199
+ describe "when expected request body is declared as a regexp" do
200
+ it "should satisfy expectation if request was executed with body matching regexp" do
201
+ lambda {
202
+ http_request(:post, "http://www.example.com/", :body => "abc")
203
+ a_request(:post, "www.example.com").with(:body => /^abc$/).should have_been_made
204
+ }.should_not raise_error
205
+ end
206
+
207
+ it "should fail if request was executed with body not matching regexp" do
208
+ lambda {
209
+ http_request(:post, "http://www.example.com/", :body => "abc")
210
+ a_request(:post, "www.example.com").
211
+ with(:body => /^xabc/).should have_been_made
212
+ }.should fail_with(%r(The request POST http://www.example.com/ with body /\^xabc/ was expected to execute 1 time but it executed 0 times))
213
+ end
214
+
215
+ end
216
+
217
+ describe "when expected reqest body is declared as a hash" do
218
+ let(:body_hash) { {:a => '1', :b => 'five', 'c' => {'d' => ['e', 'f']}} }
219
+ let(:fail_message) {%r(The request POST http://www.example.com/ with body .+ was expected to execute 1 time but it executed 0 times)}
220
+
221
+ describe "when request is made with url encoded body matching hash" do
222
+ it "should satisfy expectation" do
223
+ lambda {
224
+ http_request(:post, "http://www.example.com/", :body => 'a=1&c[d][]=e&c[d][]=f&b=five')
225
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
226
+ }.should_not raise_error
227
+ end
228
+
229
+ it "should satisfy expectation even if url encoded params have different order" do
230
+ lambda {
231
+ http_request(:post, "http://www.example.com/", :body => 'a=1&c[d][]=e&b=five&c[d][]=f')
232
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
233
+ }.should_not raise_error
234
+ end
235
+
236
+ it "should fail if request is executed with url encoded body not matching hash" do
237
+ lambda {
238
+ http_request(:post, "http://www.example.com/", :body => 'c[d][]=f&a=1&c[d][]=e')
239
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
240
+ }.should fail_with(fail_message)
241
+ end
242
+ end
243
+
244
+ describe "when request is executed with json body matching hash and Content-Type is set to json" do
245
+ it "should satisfy expectation" do
246
+ lambda {
247
+ http_request(:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
248
+ :body => "{\"a\":\"1\",\"c\":{\"d\":[\"e\",\"f\"]},\"b\":\"five\"}")
249
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
250
+ }.should_not raise_error
251
+ end
252
+
253
+ it "should satisfy expectation even if json body is in different form" do
254
+ lambda {
255
+ http_request(:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
256
+ :body => "{\"a\":\"1\",\"b\":\"five\",\"c\":{\"d\":[\"e\",\"f\"]}}")
257
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
258
+ }.should_not raise_error
259
+ end
260
+
261
+ it "should satisfy expectation even if json body contains date string" do
262
+ lambda {
263
+ http_request(:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/json'},
264
+ :body => "{\"foo\":\"2010-01-01\"}")
265
+ a_request(:post, "www.example.com").with(:body => {"foo" => "2010-01-01"}).should have_been_made
266
+ }.should_not raise_error
267
+ end
268
+ end
269
+
270
+
271
+ describe "when request is executed with xml body matching hash and content type is set to xml" do
272
+ let(:body_hash) { { "opt" => {:a => "1", :b => 'five', 'c' => {'d' => ['e', 'f']}} }}
273
+
274
+ it "should satisfy expectation" do
275
+ lambda {
276
+ http_request(:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/xml'},
277
+ :body => "<opt a=\"1\" b=\"five\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n")
278
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
279
+ }.should_not raise_error
280
+ end
281
+
282
+ it "should satisfy expectation even if xml body is in different form" do
283
+ lambda {
284
+ http_request(:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/xml'},
285
+ :body => "<opt b=\"five\" a=\"1\">\n <c>\n <d>e</d>\n <d>f</d>\n </c>\n</opt>\n")
286
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
287
+ }.should_not raise_error
288
+ end
289
+
290
+ it "should satisfy expectation even if xml body contains date string" do
291
+ lambda {
292
+ http_request(:post, "http://www.example.com/", :headers => {'Content-Type' => 'application/xml'},
293
+ :body => "<opt foo=\"2010-01-01\">\n</opt>\n")
294
+ a_request(:post, "www.example.com").with(:body => {"opt" => {"foo" => "2010-01-01"}}).should have_been_made
295
+ }.should_not raise_error
296
+ end
297
+ end
298
+ end
299
+
300
+ describe "when expected reqest body is declared as a partial hash matcher" do
301
+ let(:body_hash) { hash_including({:a => '1', 'c' => {'d' => ['e', 'f']}}) }
302
+ let(:fail_message) {%r(The request POST http://www.example.com/ with body hash_including(.+) was expected to execute 1 time but it executed 0 times)}
303
+
304
+ describe "when request is made with url encoded body matching hash" do
305
+ it "should satisfy expectation" do
306
+ lambda {
307
+ http_request(:post, "http://www.example.com/", :body => 'a=1&c[d][]=e&c[d][]=f&b=five')
308
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
309
+ }.should_not raise_error
310
+ end
311
+
312
+ it "should fail if request is executed with url encoded body not matching hash" do
313
+ lambda {
314
+ http_request(:post, "http://www.example.com/", :body => 'c[d][]=f&a=1&c[d][]=e')
315
+ a_request(:post, "www.example.com").with(:body => body_hash).should have_been_made
316
+ }.should fail_with(fail_message)
317
+ end
318
+ end
319
+ end
320
+
321
+ describe "when request with headers is expected" do
322
+ it "should satisfy expectation if request was executed with the same headers" do
323
+ lambda {
324
+ http_request(:get, "http://www.example.com/", :headers => SAMPLE_HEADERS)
325
+ a_request(:get, "www.example.com").
326
+ with(:headers => SAMPLE_HEADERS).should have_been_made
327
+ }.should_not raise_error
328
+ end
329
+
330
+ it "should satisfy expectation if request was executed with the same headers but with header value declared as array" do
331
+ lambda {
332
+ http_request(:get, "http://www.example.com/", :headers => {"a" => "b"})
333
+ a_request(:get, "www.example.com").
334
+ with(:headers => {"a" => ["b"]}).should have_been_made
335
+ }.should_not raise_error
336
+ end
337
+
338
+ describe "when multiple headers with the same key are passed" do
339
+ it "should satisfy expectation" do
340
+ lambda {
341
+ http_request(:get, "http://www.example.com/", :headers => {"a" => ["b", "c"]})
342
+ a_request(:get, "www.example.com").
343
+ with(:headers => {"a" => ["b", "c"]}).should have_been_made
344
+ }.should_not raise_error
345
+ end
346
+
347
+ it "should satisfy expectation even if request was executed with the same headers but different order" do
348
+ lambda {
349
+ http_request(:get, "http://www.example.com/", :headers => {"a" => ["b", "c"]})
350
+ a_request(:get, "www.example.com").
351
+ with(:headers => {"a" => ["c", "b"]}).should have_been_made
352
+ }.should_not raise_error
353
+ end
354
+
355
+ it "should fail if request was executed with different headers" do
356
+ lambda {
357
+ http_request(:get, "http://www.example.com/", :headers => {"a" => ["b", "c"]})
358
+ a_request(:get, "www.example.com").
359
+ with(:headers => {"a" => ["b", "d"]}).should have_been_made
360
+ }.should fail_with(%r(The request GET http://www.example.com/ with headers \{'A'=>\['b', 'd'\]\} was expected to execute 1 time but it executed 0 times))
361
+ end
362
+ end
363
+
364
+ it "should fail if request was executed with different headers" do
365
+ lambda {
366
+ http_request(:get, "http://www.example.com/", :headers => SAMPLE_HEADERS)
367
+ a_request(:get, "www.example.com").
368
+ with(:headers => { 'Content-Length' => '9999'}).should have_been_made
369
+ }.should fail_with(%r(The request GET http://www.example.com/ with headers \{'Content-Length'=>'9999'\} was expected to execute 1 time but it executed 0 times))
370
+ end
371
+
372
+ it "should fail if request was executed with less headers" do
373
+ lambda {
374
+ http_request(:get, "http://www.example.com/", :headers => {'A' => 'a'})
375
+ a_request(:get, "www.example.com").
376
+ with(:headers => {'A' => 'a', 'B' => 'b'}).should have_been_made
377
+ }.should fail_with(%r(The request GET http://www.example.com/ with headers \{'A'=>'a', 'B'=>'b'\} was expected to execute 1 time but it executed 0 times))
378
+ end
379
+
380
+ it "should satisfy expectation if request was executed with more headers" do
381
+ lambda {
382
+ http_request(:get, "http://www.example.com/",
383
+ :headers => {'A' => 'a', 'B' => 'b'}
384
+ )
385
+ a_request(:get, "www.example.com").
386
+ with(:headers => {'A' => 'a'}).should have_been_made
387
+ }.should_not raise_error
388
+ end
389
+
390
+ it "should satisfy expectation if request was executed with body and headers but they were not specified in expectantion" do
391
+ lambda {
392
+ http_request(:post, "http://www.example.com/",
393
+ :body => "abc",
394
+ :headers => SAMPLE_HEADERS
395
+ )
396
+ a_request(:post, "www.example.com").should have_been_made
397
+ }.should_not raise_error
398
+ end
399
+
400
+ it "should satisfy expectation if request was executed with headers matching regular expressions" do
401
+ lambda {
402
+ http_request(:get, "http://www.example.com/", :headers => { 'some-header' => 'MyAppName' })
403
+ a_request(:get, "www.example.com").
404
+ with(:headers => { :some_header => /^MyAppName$/ }).should have_been_made
405
+ }.should_not raise_error
406
+ end
407
+
408
+ it "should fail if request was executed with headers not matching regular expression" do
409
+ lambda {
410
+ http_request(:get, "http://www.example.com/", :headers => { 'some-header' => 'xMyAppName' })
411
+ a_request(:get, "www.example.com").
412
+ with(:headers => { :some_header => /^MyAppName$/ }).should have_been_made
413
+ }.should fail_with(%r(The request GET http://www.example.com/ with headers \{'Some-Header'=>/\^MyAppName\$/\} was expected to execute 1 time but it executed 0 times))
414
+ end
415
+ end
416
+
417
+ describe "when expectation contains a request matching block" do
418
+ it "should satisfy expectation if request was executed and block evaluated to true" do
419
+ lambda {
420
+ http_request(:post, "http://www.example.com/", :body => "wadus")
421
+ a_request(:post, "www.example.com").with { |req| req.body == "wadus" }.should have_been_made
422
+ }.should_not raise_error
423
+ end
424
+
425
+ it "should fail if request was executed and block evaluated to false" do
426
+ lambda {
427
+ http_request(:post, "http://www.example.com/", :body => "abc")
428
+ a_request(:post, "www.example.com").with { |req| req.body == "wadus" }.should have_been_made
429
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 1 time but it executed 0 times))
430
+ end
431
+
432
+ it "should fail if request was not expected but it executed and block matched request" do
433
+ lambda {
434
+ http_request(:post, "http://www.example.com/", :body => "wadus")
435
+ a_request(:post, "www.example.com").with { |req| req.body == "wadus" }.should_not have_been_made
436
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 0 times but it executed 1 time))
437
+ end
438
+ end
439
+
440
+ describe "with authentication", :unless => (adapter_info.include?(:no_url_auth)) do
441
+ before(:each) do
442
+ stub_request(:any, "http://user:pass@www.example.com")
443
+ stub_request(:any, "http://user:pazz@www.example.com")
444
+ end
445
+
446
+ it "should satisfy expectation if request was executed with expected credentials" do
447
+ lambda {
448
+ http_request(:get, "http://user:pass@www.example.com/")
449
+ a_request(:get, "http://user:pass@www.example.com").should have_been_made.once
450
+ }.should_not raise_error
451
+ end
452
+
453
+ it "should fail if request was executed with different credentials than expected" do
454
+ lambda {
455
+ http_request(:get, "http://user:pass@www.example.com/")
456
+ a_request(:get, "http://user:pazz@www.example.com").should have_been_made.once
457
+ }.should fail_with(%r(The request GET http://user:pazz@www.example.com/ was expected to execute 1 time but it executed 0 times))
458
+ end
459
+
460
+ it "should fail if request was executed without credentials and credentials were expected" do
461
+ lambda {
462
+ http_request(:get, "http://www.example.com/")
463
+ a_request(:get, "http://user:pass@www.example.com").should have_been_made.once
464
+ }.should fail_with(%r(The request GET http://user:pass@www.example.com/ was expected to execute 1 time but it executed 0 times))
465
+ end
466
+
467
+ it "should fail if request was executed with credentials but expected without credentials" do
468
+ lambda {
469
+ http_request(:get, "http://user:pass@www.example.com/")
470
+ a_request(:get, "http://www.example.com").should have_been_made.once
471
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 1 time but it executed 0 times))
472
+ end
473
+
474
+ it "should satisfy expectations even if requests were executed in different order than expectations were declared" do
475
+ stub_request(:post, "http://www.example.com")
476
+ http_request(:post, "http://www.example.com/", :body => "def")
477
+ http_request(:post, "http://www.example.com/", :body => "abc")
478
+ WebMock.should have_requested(:post, "www.example.com").with(:body => "abc")
479
+ WebMock.should have_requested(:post, "www.example.com").with(:body => "def")
480
+ end
481
+ end
482
+
483
+ describe "when expectations were set on WebMock object" do
484
+ it "should satisfy expectation if expected request was made" do
485
+ lambda {
486
+ http_request(:get, "http://www.example.com/")
487
+ WebMock.should have_requested(:get, "http://www.example.com").once
488
+ }.should_not raise_error
489
+ end
490
+
491
+ it "should satisfy expectation if request with body and headers was expected and request was made" do
492
+ lambda {
493
+ http_request(:post, "http://www.example.com/", :body => "abc", :headers => {'A' => 'a'})
494
+ WebMock.should have_requested(:post, "http://www.example.com").with(:body => "abc", :headers => {'A' => 'a'}).once
495
+ }.should_not raise_error
496
+ end
497
+
498
+ it "should fail if request expected not to be made was made" do
499
+ lambda {
500
+ http_request(:get, "http://www.example.com/")
501
+ WebMock.should_not have_requested(:get, "http://www.example.com")
502
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time))
503
+ end
504
+
505
+ it "should satisfy expectation if request was executed and expectation had block which evaluated to true" do
506
+ lambda {
507
+ http_request(:post, "http://www.example.com/", :body => "wadus")
508
+ WebMock.should have_requested(:post, "www.example.com").with { |req| req.body == "wadus" }
509
+ }.should_not raise_error
510
+ end
511
+
512
+ it "should fail if request was executed and expectation had block which evaluated to false" do
513
+ lambda {
514
+ http_request(:post, "http://www.example.com/", :body => "abc")
515
+ WebMock.should have_requested(:post, "www.example.com").with { |req| req.body == "wadus" }
516
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 1 time but it executed 0 times))
517
+ end
518
+
519
+ it "should fail if request was expected not to be made but was made and block matched request" do
520
+ lambda {
521
+ http_request(:post, "http://www.example.com/", :body => "wadus")
522
+ WebMock.should_not have_requested(:post, "www.example.com").with { |req| req.body == "wadus" }
523
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 0 times but it executed 1 time))
524
+ end
525
+ end
526
+
527
+ describe "when expectation is declared using assert_requested" do
528
+ it "should satisfy expectation if requests was made" do
529
+ lambda {
530
+ http_request(:get, "http://www.example.com/")
531
+ assert_requested(:get, "http://www.example.com", :times => 1)
532
+ assert_requested(:get, "http://www.example.com")
533
+ }.should_not raise_error
534
+ end
535
+
536
+ it "should satisfy expectation if request was made with body and headers" do
537
+ lambda {
538
+ http_request(:post, "http://www.example.com/", :body => "abc", :headers => {'A' => 'a'})
539
+ assert_requested(:post, "http://www.example.com", :body => "abc", :headers => {'A' => 'a'})
540
+ }.should_not raise_error
541
+ end
542
+
543
+ it "should fail if request expected not to be made was not wade" do
544
+ lambda {
545
+ http_request(:get, "http://www.example.com/")
546
+ assert_not_requested(:get, "http://www.example.com")
547
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time))
548
+ end
549
+
550
+ it "should fail if request expected not to be made was made and expectation block evaluated to true" do
551
+ lambda {
552
+ http_request(:post, "http://www.example.com/", :body => "wadus")
553
+ assert_not_requested(:post, "www.example.com") { |req| req.body == "wadus" }
554
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 0 times but it executed 1 time))
555
+ end
556
+
557
+ it "should satisfy expectation if request was made and expectation block evaluated to true" do
558
+ lambda {
559
+ http_request(:post, "http://www.example.com/", :body => "wadus")
560
+ assert_requested(:post, "www.example.com") { |req| req.body == "wadus" }
561
+ }.should_not raise_error
562
+ end
563
+
564
+ it "should fail if request was made and expectation block evaluated to false" do
565
+ lambda {
566
+ http_request(:post, "http://www.example.com/", :body => "abc")
567
+ assert_requested(:post, "www.example.com") { |req| req.body == "wadus" }
568
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 1 time but it executed 0 times))
569
+ end
570
+ end
571
+
572
+ describe "when expectation is declared using assert_requested" do
573
+ it "should satisfy expectation if requests was made" do
574
+ stub_http = stub_http_request(:get, "http://www.example.com")
575
+ lambda {
576
+ http_request(:get, "http://www.example.com/")
577
+ assert_requested(stub_http, :times => 1)
578
+ assert_requested(stub_http)
579
+ }.should_not raise_error
580
+ end
581
+
582
+ it "should fail if request expected not to be made was not wade" do
583
+ stub_http = stub_http_request(:get, "http://www.example.com")
584
+ lambda {
585
+ http_request(:get, "http://www.example.com/")
586
+ assert_not_requested(stub_http)
587
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time))
588
+ end
589
+ end
590
+ end
591
+
592
+
593
+ describe "expectation is set on the request stub" do
594
+ it "should satisfy expectation if expected request was made" do
595
+ stub = stub_request(:get, "http://www.example.com/")
596
+ http_request(:get, "http://www.example.com/")
597
+ stub.should have_been_requested.once
598
+ end
599
+
600
+ it "should satisfy expectations if subsequent requests were made" do
601
+ stub = stub_request(:get, "http://www.example.com/")
602
+ http_request(:get, "http://www.example.com/")
603
+ stub.should have_been_requested.once
604
+ http_request(:get, "http://www.example.com/")
605
+ stub.should have_been_requested.twice
606
+ end
607
+
608
+ it "should satisfy expectation if expected request with body and headers was made" do
609
+ stub = stub_request(:post, "http://www.example.com").with(:body => "abc", :headers => {'A' => 'a'})
610
+ http_request(:post, "http://www.example.com/", :body => "abc", :headers => {'A' => 'a'})
611
+ stub.should have_been_requested.once
612
+ end
613
+
614
+ it "should fail if request not expected to be made was made" do
615
+ lambda {
616
+ stub = stub_request(:get, "http://www.example.com")
617
+ http_request(:get, "http://www.example.com/")
618
+ stub.should_not have_been_requested
619
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time))
620
+ end
621
+
622
+ it "should fail request not expected to be made was made and expectation block evaluated to true" do
623
+ lambda {
624
+ stub = stub_request(:post, "www.example.com").with { |req| req.body == "wadus" }
625
+ http_request(:post, "http://www.example.com/", :body => "wadus")
626
+ stub.should_not have_been_requested
627
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 0 times but it executed 1 time))
628
+ end
629
+
630
+ it "should satisfy expectation if request was made and expectation block evaluated to true" do
631
+ stub = stub_request(:post, "www.example.com").with { |req| req.body == "wadus" }
632
+ http_request(:post, "http://www.example.com/", :body => "wadus")
633
+ stub.should have_been_requested
634
+ end
635
+
636
+ it "should satisfy expectation if request was made and expectation block evaluated to false" do
637
+ lambda {
638
+ stub_request(:any, /.+/) #stub any request
639
+ stub = stub_request(:post, "www.example.com").with { |req| req.body == "wadus" }
640
+ http_request(:post, "http://www.example.com/", :body => "abc")
641
+ stub.should have_been_requested
642
+ }.should fail_with(%r(The request POST http://www.example.com/ with given block was expected to execute 1 time but it executed 0 times))
643
+ end
644
+ end
645
+
646
+ describe "when net connect is allowed", :net_connect => true do
647
+ before(:each) do
648
+ WebMock.allow_net_connect!
649
+ end
650
+
651
+ it "should satisfy expectation if expected requests was made" do
652
+ lambda {
653
+ http_request(:get, "http://www.example.com/")
654
+ a_request(:get, "http://www.example.com").should have_been_made
655
+ }.should_not raise_error
656
+ end
657
+
658
+ it "should fail request expected not to be made, was made" do
659
+ lambda {
660
+ http_request(:get, "http://www.example.com/")
661
+ a_request(:get, "http://www.example.com").should_not have_been_made
662
+ }.should fail_with(%r(The request GET http://www.example.com/ was expected to execute 0 times but it executed 1 time))
663
+ end
664
+ end
665
+ end
666
+ end