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,499 @@
1
+ require 'test_helper'
2
+
3
+ class XmlTest < Test::Unit::TestCase
4
+ should "should transform a simple tag with content" do
5
+ xml = "<tag>This is the contents</tag>"
6
+ Crack::XML.parse(xml).should == { 'tag' => 'This is the contents' }
7
+ end
8
+
9
+ should "should work with cdata tags" do
10
+ xml = <<-END
11
+ <tag>
12
+ <![CDATA[
13
+ text inside cdata
14
+ ]]>
15
+ </tag>
16
+ END
17
+ Crack::XML.parse(xml)["tag"].strip.should == "text inside cdata"
18
+ end
19
+
20
+ should "should transform a simple tag with attributes" do
21
+ xml = "<tag attr1='1' attr2='2'></tag>"
22
+ hash = { 'tag' => { 'attr1' => '1', 'attr2' => '2' } }
23
+ Crack::XML.parse(xml).should == hash
24
+ end
25
+
26
+ should "should transform repeating siblings into an array" do
27
+ xml =<<-XML
28
+ <opt>
29
+ <user login="grep" fullname="Gary R Epstein" />
30
+ <user login="stty" fullname="Simon T Tyson" />
31
+ </opt>
32
+ XML
33
+
34
+ Crack::XML.parse(xml)['opt']['user'].class.should == Array
35
+
36
+ hash = {
37
+ 'opt' => {
38
+ 'user' => [{
39
+ 'login' => 'grep',
40
+ 'fullname' => 'Gary R Epstein'
41
+ },{
42
+ 'login' => 'stty',
43
+ 'fullname' => 'Simon T Tyson'
44
+ }]
45
+ }
46
+ }
47
+
48
+ Crack::XML.parse(xml).should == hash
49
+ end
50
+
51
+ should "should not transform non-repeating siblings into an array" do
52
+ xml =<<-XML
53
+ <opt>
54
+ <user login="grep" fullname="Gary R Epstein" />
55
+ </opt>
56
+ XML
57
+
58
+ Crack::XML.parse(xml)['opt']['user'].class.should == Hash
59
+
60
+ hash = {
61
+ 'opt' => {
62
+ 'user' => {
63
+ 'login' => 'grep',
64
+ 'fullname' => 'Gary R Epstein'
65
+ }
66
+ }
67
+ }
68
+
69
+ Crack::XML.parse(xml).should == hash
70
+ end
71
+
72
+ context "Parsing xml with text and attributes" do
73
+ setup do
74
+ xml =<<-XML
75
+ <opt>
76
+ <user login="grep">Gary R Epstein</user>
77
+ <user>Simon T Tyson</user>
78
+ </opt>
79
+ XML
80
+ @data = Crack::XML.parse(xml)
81
+ end
82
+
83
+ should "correctly parse text nodes" do
84
+ @data.should == {
85
+ 'opt' => {
86
+ 'user' => [
87
+ 'Gary R Epstein',
88
+ 'Simon T Tyson'
89
+ ]
90
+ }
91
+ }
92
+ end
93
+
94
+ should "be parse attributes for text node if present" do
95
+ @data['opt']['user'][0].attributes.should == {'login' => 'grep'}
96
+ end
97
+
98
+ should "default attributes to empty hash if not present" do
99
+ @data['opt']['user'][1].attributes.should == {}
100
+ end
101
+
102
+ should "add 'attributes' accessor methods to parsed instances of String" do
103
+ @data['opt']['user'][0].respond_to?(:attributes).should be(true)
104
+ @data['opt']['user'][0].respond_to?(:attributes=).should be(true)
105
+ end
106
+
107
+ should "not add 'attributes' accessor methods to all instances of String" do
108
+ "some-string".respond_to?(:attributes).should be(false)
109
+ "some-string".respond_to?(:attributes=).should be(false)
110
+ end
111
+ end
112
+
113
+ should "should typecast an integer" do
114
+ xml = "<tag type='integer'>10</tag>"
115
+ Crack::XML.parse(xml)['tag'].should == 10
116
+ end
117
+
118
+ should "should typecast a true boolean" do
119
+ xml = "<tag type='boolean'>true</tag>"
120
+ Crack::XML.parse(xml)['tag'].should be(true)
121
+ end
122
+
123
+ should "should typecast a false boolean" do
124
+ ["false"].each do |w|
125
+ Crack::XML.parse("<tag type='boolean'>#{w}</tag>")['tag'].should be(false)
126
+ end
127
+ end
128
+
129
+ should "should typecast a datetime" do
130
+ xml = "<tag type='datetime'>2007-12-31 10:32</tag>"
131
+ Crack::XML.parse(xml)['tag'].should == Time.parse( '2007-12-31 10:32' ).utc
132
+ end
133
+
134
+ should "should typecast a date" do
135
+ xml = "<tag type='date'>2007-12-31</tag>"
136
+ Crack::XML.parse(xml)['tag'].should == Date.parse('2007-12-31')
137
+ end
138
+
139
+ xml_entities = {
140
+ "<" => "&lt;",
141
+ ">" => "&gt;",
142
+ '"' => "&quot;",
143
+ "'" => "&apos;",
144
+ "&" => "&amp;"
145
+ }
146
+ should "should unescape html entities" do
147
+ xml_entities.each do |k,v|
148
+ xml = "<tag>Some content #{v}</tag>"
149
+ Crack::XML.parse(xml)['tag'].should =~ Regexp.new(k)
150
+ end
151
+ end
152
+
153
+ should "should unescape XML entities in attributes" do
154
+ xml_entities.each do |k,v|
155
+ xml = "<tag attr='Some content #{v}'></tag>"
156
+ Crack::XML.parse(xml)['tag']['attr'].should =~ Regexp.new(k)
157
+ end
158
+ end
159
+
160
+ should "should undasherize keys as tags" do
161
+ xml = "<tag-1>Stuff</tag-1>"
162
+ Crack::XML.parse(xml).keys.should include( 'tag_1' )
163
+ end
164
+
165
+ should "should undasherize keys as attributes" do
166
+ xml = "<tag1 attr-1='1'></tag1>"
167
+ Crack::XML.parse(xml)['tag1'].keys.should include( 'attr_1')
168
+ end
169
+
170
+ should "should undasherize keys as tags and attributes" do
171
+ xml = "<tag-1 attr-1='1'></tag-1>"
172
+ Crack::XML.parse(xml).keys.should include( 'tag_1' )
173
+ Crack::XML.parse(xml)['tag_1'].keys.should include( 'attr_1')
174
+ end
175
+
176
+ should "should render nested content correctly" do
177
+ xml = "<root><tag1>Tag1 Content <em><strong>This is strong</strong></em></tag1></root>"
178
+ Crack::XML.parse(xml)['root']['tag1'].should == "Tag1 Content <em><strong>This is strong</strong></em>"
179
+ end
180
+
181
+ should "should render nested content with splshould text nodes correctly" do
182
+ xml = "<root>Tag1 Content<em>Stuff</em> Hi There</root>"
183
+ Crack::XML.parse(xml)['root'].should == "Tag1 Content<em>Stuff</em> Hi There"
184
+ end
185
+
186
+ should "should ignore attributes when a child is a text node" do
187
+ xml = "<root attr1='1'>Stuff</root>"
188
+ Crack::XML.parse(xml).should == { "root" => "Stuff" }
189
+ end
190
+
191
+ should "should ignore attributes when any child is a text node" do
192
+ xml = "<root attr1='1'>Stuff <em>in italics</em></root>"
193
+ Crack::XML.parse(xml).should == { "root" => "Stuff <em>in italics</em>" }
194
+ end
195
+
196
+ should "should correctly transform multiple children" do
197
+ xml = <<-XML
198
+ <user gender='m'>
199
+ <age type='integer'>35</age>
200
+ <name>Home Simpson</name>
201
+ <dob type='date'>1988-01-01</dob>
202
+ <joined-at type='datetime'>2000-04-28 23:01</joined-at>
203
+ <is-cool type='boolean'>true</is-cool>
204
+ </user>
205
+ XML
206
+
207
+ hash = {
208
+ "user" => {
209
+ "gender" => "m",
210
+ "age" => 35,
211
+ "name" => "Home Simpson",
212
+ "dob" => Date.parse('1988-01-01'),
213
+ "joined_at" => Time.parse("2000-04-28 23:01"),
214
+ "is_cool" => true
215
+ }
216
+ }
217
+
218
+ Crack::XML.parse(xml).should == hash
219
+ end
220
+
221
+ should "should properly handle nil values (ActiveSupport Compatible)" do
222
+ topic_xml = <<-EOT
223
+ <topic>
224
+ <title></title>
225
+ <id type="integer"></id>
226
+ <approved type="boolean"></approved>
227
+ <written-on type="date"></written-on>
228
+ <viewed-at type="datetime"></viewed-at>
229
+ <content type="yaml"></content>
230
+ <parent-id></parent-id>
231
+ </topic>
232
+ EOT
233
+
234
+ expected_topic_hash = {
235
+ 'title' => nil,
236
+ 'id' => nil,
237
+ 'approved' => nil,
238
+ 'written_on' => nil,
239
+ 'viewed_at' => nil,
240
+ 'content' => nil,
241
+ 'parent_id' => nil
242
+ }
243
+ Crack::XML.parse(topic_xml)["topic"].should == expected_topic_hash
244
+ end
245
+
246
+ should "should handle a single record from xml (ActiveSupport Compatible)" do
247
+ topic_xml = <<-EOT
248
+ <topic>
249
+ <title>The First Topic</title>
250
+ <author-name>David</author-name>
251
+ <id type="integer">1</id>
252
+ <approved type="boolean"> true </approved>
253
+ <replies-count type="integer">0</replies-count>
254
+ <replies-close-in type="integer">2592000000</replies-close-in>
255
+ <written-on type="date">2003-07-16</written-on>
256
+ <viewed-at type="datetime">2003-07-16T09:28:00+0000</viewed-at>
257
+ <content type="yaml">--- \n1: should be an integer\n:message: Have a nice day\narray: \n- should-have-dashes: true\n should_have_underscores: true\n</content>
258
+ <author-email-address>david@loudthinking.com</author-email-address>
259
+ <parent-id></parent-id>
260
+ <ad-revenue type="decimal">1.5</ad-revenue>
261
+ <optimum-viewing-angle type="float">135</optimum-viewing-angle>
262
+ <resident type="symbol">yes</resident>
263
+ </topic>
264
+ EOT
265
+
266
+ expected_topic_hash = {
267
+ 'title' => "The First Topic",
268
+ 'author_name' => "David",
269
+ 'id' => 1,
270
+ 'approved' => true,
271
+ 'replies_count' => 0,
272
+ 'replies_close_in' => 2592000000,
273
+ 'written_on' => Date.new(2003, 7, 16),
274
+ 'viewed_at' => Time.utc(2003, 7, 16, 9, 28),
275
+ # Changed this line where the key is :message. The yaml specifies this as a symbol, and who am I to change what you specify
276
+ # The line in ActiveSupport is
277
+ # 'content' => { 'message' => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
278
+ 'content' => { :message => "Have a nice day", 1 => "should be an integer", "array" => [{ "should-have-dashes" => true, "should_have_underscores" => true }] },
279
+ 'author_email_address' => "david@loudthinking.com",
280
+ 'parent_id' => nil,
281
+ 'ad_revenue' => BigDecimal("1.50"),
282
+ 'optimum_viewing_angle' => 135.0,
283
+ 'resident' => :yes
284
+ }
285
+
286
+ Crack::XML.parse(topic_xml)["topic"].each do |k,v|
287
+ v.should == expected_topic_hash[k]
288
+ end
289
+ end
290
+
291
+ should "should handle multiple records (ActiveSupport Compatible)" do
292
+ topics_xml = <<-EOT
293
+ <topics type="array">
294
+ <topic>
295
+ <title>The First Topic</title>
296
+ <author-name>David</author-name>
297
+ <id type="integer">1</id>
298
+ <approved type="boolean">false</approved>
299
+ <replies-count type="integer">0</replies-count>
300
+ <replies-close-in type="integer">2592000000</replies-close-in>
301
+ <written-on type="date">2003-07-16</written-on>
302
+ <viewed-at type="datetime">2003-07-16T09:28:00+0000</viewed-at>
303
+ <content>Have a nice day</content>
304
+ <author-email-address>david@loudthinking.com</author-email-address>
305
+ <parent-id nil="true"></parent-id>
306
+ </topic>
307
+ <topic>
308
+ <title>The Second Topic</title>
309
+ <author-name>Jason</author-name>
310
+ <id type="integer">1</id>
311
+ <approved type="boolean">false</approved>
312
+ <replies-count type="integer">0</replies-count>
313
+ <replies-close-in type="integer">2592000000</replies-close-in>
314
+ <written-on type="date">2003-07-16</written-on>
315
+ <viewed-at type="datetime">2003-07-16T09:28:00+0000</viewed-at>
316
+ <content>Have a nice day</content>
317
+ <author-email-address>david@loudthinking.com</author-email-address>
318
+ <parent-id></parent-id>
319
+ </topic>
320
+ </topics>
321
+ EOT
322
+
323
+ expected_topic_hash = {
324
+ 'title' => "The First Topic",
325
+ 'author_name' => "David",
326
+ 'id' => 1,
327
+ 'approved' => false,
328
+ 'replies_count' => 0,
329
+ 'replies_close_in' => 2592000000,
330
+ 'written_on' => Date.new(2003, 7, 16),
331
+ 'viewed_at' => Time.utc(2003, 7, 16, 9, 28),
332
+ 'content' => "Have a nice day",
333
+ 'author_email_address' => "david@loudthinking.com",
334
+ 'parent_id' => nil
335
+ }
336
+ # puts Crack::XML.parse(topics_xml)['topics'].first.inspect
337
+ Crack::XML.parse(topics_xml)["topics"].first.each do |k,v|
338
+ v.should == expected_topic_hash[k]
339
+ end
340
+ end
341
+
342
+ should "should handle a single record from_xml with attributes other than type (ActiveSupport Compatible)" do
343
+ topic_xml = <<-EOT
344
+ <rsp stat="ok">
345
+ <photos page="1" pages="1" perpage="100" total="16">
346
+ <photo id="175756086" owner="55569174@N00" secret="0279bf37a1" server="76" title="Colored Pencil PhotoBooth Fun" ispublic="1" isfriend="0" isfamily="0"/>
347
+ </photos>
348
+ </rsp>
349
+ EOT
350
+
351
+ expected_topic_hash = {
352
+ 'id' => "175756086",
353
+ 'owner' => "55569174@N00",
354
+ 'secret' => "0279bf37a1",
355
+ 'server' => "76",
356
+ 'title' => "Colored Pencil PhotoBooth Fun",
357
+ 'ispublic' => "1",
358
+ 'isfriend' => "0",
359
+ 'isfamily' => "0",
360
+ }
361
+ Crack::XML.parse(topic_xml)["rsp"]["photos"]["photo"].each do |k,v|
362
+ v.should == expected_topic_hash[k]
363
+ end
364
+ end
365
+
366
+ should "should handle an emtpy array (ActiveSupport Compatible)" do
367
+ blog_xml = <<-XML
368
+ <blog>
369
+ <posts type="array"></posts>
370
+ </blog>
371
+ XML
372
+ expected_blog_hash = {"blog" => {"posts" => []}}
373
+ Crack::XML.parse(blog_xml).should == expected_blog_hash
374
+ end
375
+
376
+ should "should handle empty array with whitespace from xml (ActiveSupport Compatible)" do
377
+ blog_xml = <<-XML
378
+ <blog>
379
+ <posts type="array">
380
+ </posts>
381
+ </blog>
382
+ XML
383
+ expected_blog_hash = {"blog" => {"posts" => []}}
384
+ Crack::XML.parse(blog_xml).should == expected_blog_hash
385
+ end
386
+
387
+ should "should handle array with one entry from_xml (ActiveSupport Compatible)" do
388
+ blog_xml = <<-XML
389
+ <blog>
390
+ <posts type="array">
391
+ <post>a post</post>
392
+ </posts>
393
+ </blog>
394
+ XML
395
+ expected_blog_hash = {"blog" => {"posts" => ["a post"]}}
396
+ Crack::XML.parse(blog_xml).should == expected_blog_hash
397
+ end
398
+
399
+ should "should handle array with multiple entries from xml (ActiveSupport Compatible)" do
400
+ blog_xml = <<-XML
401
+ <blog>
402
+ <posts type="array">
403
+ <post>a post</post>
404
+ <post>another post</post>
405
+ </posts>
406
+ </blog>
407
+ XML
408
+ expected_blog_hash = {"blog" => {"posts" => ["a post", "another post"]}}
409
+ Crack::XML.parse(blog_xml).should == expected_blog_hash
410
+ end
411
+
412
+ should "should handle file types (ActiveSupport Compatible)" do
413
+ blog_xml = <<-XML
414
+ <blog>
415
+ <logo type="file" name="logo.png" content_type="image/png">
416
+ </logo>
417
+ </blog>
418
+ XML
419
+ hash = Crack::XML.parse(blog_xml)
420
+ hash.keys.should include('blog')
421
+ hash['blog'].keys.should include('logo')
422
+
423
+ file = hash['blog']['logo']
424
+ file.original_filename.should == 'logo.png'
425
+ file.content_type.should == 'image/png'
426
+ end
427
+
428
+ should "should handle file from xml with defaults (ActiveSupport Compatible)" do
429
+ blog_xml = <<-XML
430
+ <blog>
431
+ <logo type="file">
432
+ </logo>
433
+ </blog>
434
+ XML
435
+ file = Crack::XML.parse(blog_xml)['blog']['logo']
436
+ file.original_filename.should == 'untitled'
437
+ file.content_type.should == 'application/octet-stream'
438
+ end
439
+
440
+ should "should handle xsd like types from xml (ActiveSupport Compatible)" do
441
+ bacon_xml = <<-EOT
442
+ <bacon>
443
+ <weight type="double">0.5</weight>
444
+ <price type="decimal">12.50</price>
445
+ <chunky type="boolean"> 1 </chunky>
446
+ <expires-at type="dateTime">2007-12-25T12:34:56+0000</expires-at>
447
+ <notes type="string"></notes>
448
+ <illustration type="base64Binary">YmFiZS5wbmc=</illustration>
449
+ </bacon>
450
+ EOT
451
+
452
+ expected_bacon_hash = {
453
+ 'weight' => 0.5,
454
+ 'chunky' => true,
455
+ 'price' => BigDecimal("12.50"),
456
+ 'expires_at' => Time.utc(2007,12,25,12,34,56),
457
+ 'notes' => "",
458
+ 'illustration' => "babe.png"
459
+ }
460
+
461
+ Crack::XML.parse(bacon_xml)["bacon"].should == expected_bacon_hash
462
+ end
463
+
464
+ should "should let type trickle through when unknown (ActiveSupport Compatible)" do
465
+ product_xml = <<-EOT
466
+ <product>
467
+ <weight type="double">0.5</weight>
468
+ <image type="ProductImage"><filename>image.gif</filename></image>
469
+
470
+ </product>
471
+ EOT
472
+
473
+ expected_product_hash = {
474
+ 'weight' => 0.5,
475
+ 'image' => {'type' => 'ProductImage', 'filename' => 'image.gif' },
476
+ }
477
+
478
+ Crack::XML.parse(product_xml)["product"].should == expected_product_hash
479
+ end
480
+
481
+ should "should handle unescaping from xml (ActiveResource Compatible)" do
482
+ xml_string = '<person><bare-string>First &amp; Last Name</bare-string><pre-escaped-string>First &amp;amp; Last Name</pre-escaped-string></person>'
483
+ expected_hash = {
484
+ 'bare_string' => 'First & Last Name',
485
+ 'pre_escaped_string' => 'First &amp; Last Name'
486
+ }
487
+
488
+ Crack::XML.parse(xml_string)['person'].should == expected_hash
489
+ end
490
+
491
+ should "handle an empty xml string" do
492
+ Crack::XML.parse('').should == {}
493
+ end
494
+
495
+ # As returned in the response body by the unfuddle XML API when creating objects
496
+ should "handle an xml string containing a single space" do
497
+ Crack::XML.parse(' ').should == {}
498
+ end
499
+ end