mercadopago-custom-checkout 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.gs/bin/rake +23 -0
  4. data/.gs/cache/faraday-0.9.2.gem +0 -0
  5. data/.gs/cache/minitest-5.9.0.gem +0 -0
  6. data/.gs/cache/multi_json-1.12.1.gem +0 -0
  7. data/.gs/cache/multipart-post-2.0.0.gem +0 -0
  8. data/.gs/cache/rake-10.5.0.gem +0 -0
  9. data/.gs/gems/faraday-0.9.2/LICENSE.md +20 -0
  10. data/.gs/gems/faraday-0.9.2/README.md +245 -0
  11. data/.gs/gems/faraday-0.9.2/lib/faraday.rb +268 -0
  12. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter.rb +46 -0
  13. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http.rb +237 -0
  14. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http_ssl_patch.rb +56 -0
  15. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony.rb +100 -0
  16. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony/parallel_manager.rb +66 -0
  17. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/excon.rb +81 -0
  18. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/httpclient.rb +117 -0
  19. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb +130 -0
  20. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb +49 -0
  21. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/patron.rb +78 -0
  22. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/rack.rb +58 -0
  23. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/test.rb +162 -0
  24. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/typhoeus.rb +123 -0
  25. data/.gs/gems/faraday-0.9.2/lib/faraday/autoload.rb +84 -0
  26. data/.gs/gems/faraday-0.9.2/lib/faraday/connection.rb +437 -0
  27. data/.gs/gems/faraday-0.9.2/lib/faraday/error.rb +53 -0
  28. data/.gs/gems/faraday-0.9.2/lib/faraday/middleware.rb +37 -0
  29. data/.gs/gems/faraday-0.9.2/lib/faraday/options.rb +359 -0
  30. data/.gs/gems/faraday-0.9.2/lib/faraday/parameters.rb +197 -0
  31. data/.gs/gems/faraday-0.9.2/lib/faraday/rack_builder.rb +213 -0
  32. data/.gs/gems/faraday-0.9.2/lib/faraday/request.rb +92 -0
  33. data/.gs/gems/faraday-0.9.2/lib/faraday/request/authorization.rb +42 -0
  34. data/.gs/gems/faraday-0.9.2/lib/faraday/request/basic_authentication.rb +13 -0
  35. data/.gs/gems/faraday-0.9.2/lib/faraday/request/instrumentation.rb +36 -0
  36. data/.gs/gems/faraday-0.9.2/lib/faraday/request/multipart.rb +63 -0
  37. data/.gs/gems/faraday-0.9.2/lib/faraday/request/retry.rb +154 -0
  38. data/.gs/gems/faraday-0.9.2/lib/faraday/request/token_authentication.rb +15 -0
  39. data/.gs/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb +36 -0
  40. data/.gs/gems/faraday-0.9.2/lib/faraday/response.rb +93 -0
  41. data/.gs/gems/faraday-0.9.2/lib/faraday/response/logger.rb +59 -0
  42. data/.gs/gems/faraday-0.9.2/lib/faraday/response/raise_error.rb +21 -0
  43. data/.gs/gems/faraday-0.9.2/lib/faraday/upload_io.rb +67 -0
  44. data/.gs/gems/faraday-0.9.2/lib/faraday/utils.rb +309 -0
  45. data/.gs/gems/minitest-5.9.0/.autotest +34 -0
  46. data/.gs/gems/minitest-5.9.0/History.rdoc +1176 -0
  47. data/.gs/gems/minitest-5.9.0/Manifest.txt +26 -0
  48. data/.gs/gems/minitest-5.9.0/README.rdoc +656 -0
  49. data/.gs/gems/minitest-5.9.0/Rakefile +72 -0
  50. data/.gs/gems/minitest-5.9.0/design_rationale.rb +52 -0
  51. data/.gs/gems/minitest-5.9.0/lib/hoe/minitest.rb +26 -0
  52. data/.gs/gems/minitest-5.9.0/lib/minitest.rb +815 -0
  53. data/.gs/gems/minitest-5.9.0/lib/minitest/assertions.rb +674 -0
  54. data/.gs/gems/minitest-5.9.0/lib/minitest/autorun.rb +13 -0
  55. data/.gs/gems/minitest-5.9.0/lib/minitest/benchmark.rb +424 -0
  56. data/.gs/gems/minitest-5.9.0/lib/minitest/expectations.rb +284 -0
  57. data/.gs/gems/minitest-5.9.0/lib/minitest/hell.rb +17 -0
  58. data/.gs/gems/minitest-5.9.0/lib/minitest/mock.rb +232 -0
  59. data/.gs/gems/minitest-5.9.0/lib/minitest/parallel.rb +69 -0
  60. data/.gs/gems/minitest-5.9.0/lib/minitest/pride.rb +4 -0
  61. data/.gs/gems/minitest-5.9.0/lib/minitest/pride_plugin.rb +142 -0
  62. data/.gs/gems/minitest-5.9.0/lib/minitest/spec.rb +331 -0
  63. data/.gs/gems/minitest-5.9.0/lib/minitest/test.rb +284 -0
  64. data/.gs/gems/minitest-5.9.0/lib/minitest/unit.rb +45 -0
  65. data/.gs/gems/minitest-5.9.0/test/minitest/metametameta.rb +90 -0
  66. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_benchmark.rb +137 -0
  67. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_mock.rb +512 -0
  68. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_reporter.rb +281 -0
  69. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_spec.rb +967 -0
  70. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_test.rb +1983 -0
  71. data/.gs/gems/multi_json-1.12.1/CHANGELOG.md +245 -0
  72. data/.gs/gems/multi_json-1.12.1/CONTRIBUTING.md +46 -0
  73. data/.gs/gems/multi_json-1.12.1/LICENSE.md +20 -0
  74. data/.gs/gems/multi_json-1.12.1/README.md +121 -0
  75. data/.gs/gems/multi_json-1.12.1/lib/multi_json.rb +161 -0
  76. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter.rb +49 -0
  77. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter_error.rb +15 -0
  78. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/gson.rb +20 -0
  79. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/jr_jackson.rb +25 -0
  80. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_common.rb +23 -0
  81. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_gem.rb +11 -0
  82. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_pure.rb +11 -0
  83. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/nsjsonserialization.rb +32 -0
  84. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/oj.rb +25 -0
  85. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/ok_json.rb +23 -0
  86. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/yajl.rb +19 -0
  87. data/.gs/gems/multi_json-1.12.1/lib/multi_json/convertible_hash_keys.rb +43 -0
  88. data/.gs/gems/multi_json-1.12.1/lib/multi_json/options.rb +39 -0
  89. data/.gs/gems/multi_json-1.12.1/lib/multi_json/options_cache.rb +29 -0
  90. data/.gs/gems/multi_json-1.12.1/lib/multi_json/parse_error.rb +17 -0
  91. data/.gs/gems/multi_json-1.12.1/lib/multi_json/vendor/okjson.rb +606 -0
  92. data/.gs/gems/multi_json-1.12.1/lib/multi_json/version.rb +17 -0
  93. data/.gs/gems/multi_json-1.12.1/multi_json.gemspec +20 -0
  94. data/.gs/gems/multipart-post-2.0.0/.gitignore +6 -0
  95. data/.gs/gems/multipart-post-2.0.0/.travis.yml +7 -0
  96. data/.gs/gems/multipart-post-2.0.0/Gemfile +14 -0
  97. data/.gs/gems/multipart-post-2.0.0/History.txt +60 -0
  98. data/.gs/gems/multipart-post-2.0.0/Manifest.txt +9 -0
  99. data/.gs/gems/multipart-post-2.0.0/README.md +77 -0
  100. data/.gs/gems/multipart-post-2.0.0/Rakefile +9 -0
  101. data/.gs/gems/multipart-post-2.0.0/lib/composite_io.rb +108 -0
  102. data/.gs/gems/multipart-post-2.0.0/lib/multipart_post.rb +9 -0
  103. data/.gs/gems/multipart-post-2.0.0/lib/multipartable.rb +29 -0
  104. data/.gs/gems/multipart-post-2.0.0/lib/net/http/post/multipart.rb +27 -0
  105. data/.gs/gems/multipart-post-2.0.0/lib/parts.rb +96 -0
  106. data/.gs/gems/multipart-post-2.0.0/multipart-post.gemspec +22 -0
  107. data/.gs/gems/multipart-post-2.0.0/test/multibyte.txt +1 -0
  108. data/.gs/gems/multipart-post-2.0.0/test/net/http/post/test_multipart.rb +110 -0
  109. data/.gs/gems/multipart-post-2.0.0/test/test_composite_io.rb +115 -0
  110. data/.gs/gems/multipart-post-2.0.0/test/test_parts.rb +86 -0
  111. data/.gs/gems/rake-10.5.0/.autotest +7 -0
  112. data/.gs/gems/rake-10.5.0/.rubocop.yml +27 -0
  113. data/.gs/gems/rake-10.5.0/.togglerc +7 -0
  114. data/.gs/gems/rake-10.5.0/CONTRIBUTING.rdoc +38 -0
  115. data/.gs/gems/rake-10.5.0/History.rdoc +659 -0
  116. data/.gs/gems/rake-10.5.0/MIT-LICENSE +21 -0
  117. data/.gs/gems/rake-10.5.0/Manifest.txt +166 -0
  118. data/.gs/gems/rake-10.5.0/README.rdoc +139 -0
  119. data/.gs/gems/rake-10.5.0/Rakefile +81 -0
  120. data/.gs/gems/rake-10.5.0/bin/rake +33 -0
  121. data/.gs/gems/rake-10.5.0/doc/command_line_usage.rdoc +158 -0
  122. data/.gs/gems/rake-10.5.0/doc/example/Rakefile1 +38 -0
  123. data/.gs/gems/rake-10.5.0/doc/example/Rakefile2 +35 -0
  124. data/.gs/gems/rake-10.5.0/doc/example/a.c +6 -0
  125. data/.gs/gems/rake-10.5.0/doc/example/b.c +6 -0
  126. data/.gs/gems/rake-10.5.0/doc/example/main.c +11 -0
  127. data/.gs/gems/rake-10.5.0/doc/glossary.rdoc +42 -0
  128. data/.gs/gems/rake-10.5.0/doc/jamis.rb +591 -0
  129. data/.gs/gems/rake-10.5.0/doc/proto_rake.rdoc +127 -0
  130. data/.gs/gems/rake-10.5.0/doc/rake.1 +141 -0
  131. data/.gs/gems/rake-10.5.0/doc/rakefile.rdoc +624 -0
  132. data/.gs/gems/rake-10.5.0/doc/rational.rdoc +151 -0
  133. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.4.14.rdoc +23 -0
  134. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.4.15.rdoc +35 -0
  135. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.5.0.rdoc +53 -0
  136. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.5.3.rdoc +78 -0
  137. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.5.4.rdoc +46 -0
  138. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.6.0.rdoc +141 -0
  139. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.0.rdoc +119 -0
  140. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.1.rdoc +59 -0
  141. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.2.rdoc +121 -0
  142. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.3.rdoc +47 -0
  143. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.0.rdoc +114 -0
  144. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.2.rdoc +165 -0
  145. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.3.rdoc +112 -0
  146. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.4.rdoc +147 -0
  147. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.5.rdoc +53 -0
  148. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.6.rdoc +37 -0
  149. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.7.rdoc +55 -0
  150. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.0.rdoc +112 -0
  151. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.1.rdoc +52 -0
  152. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
  153. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.rdoc +49 -0
  154. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.3.rdoc +102 -0
  155. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.4.rdoc +60 -0
  156. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.5.rdoc +55 -0
  157. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.6.rdoc +64 -0
  158. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.0.rdoc +178 -0
  159. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.1.rdoc +58 -0
  160. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.2.rdoc +53 -0
  161. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.3.rdoc +191 -0
  162. data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.1.0.rdoc +61 -0
  163. data/.gs/gems/rake-10.5.0/lib/rake.rb +79 -0
  164. data/.gs/gems/rake-10.5.0/lib/rake/alt_system.rb +110 -0
  165. data/.gs/gems/rake-10.5.0/lib/rake/application.rb +790 -0
  166. data/.gs/gems/rake-10.5.0/lib/rake/backtrace.rb +23 -0
  167. data/.gs/gems/rake-10.5.0/lib/rake/clean.rb +76 -0
  168. data/.gs/gems/rake-10.5.0/lib/rake/cloneable.rb +16 -0
  169. data/.gs/gems/rake-10.5.0/lib/rake/contrib/.document +1 -0
  170. data/.gs/gems/rake-10.5.0/lib/rake/contrib/compositepublisher.rb +21 -0
  171. data/.gs/gems/rake-10.5.0/lib/rake/contrib/ftptools.rb +137 -0
  172. data/.gs/gems/rake-10.5.0/lib/rake/contrib/publisher.rb +81 -0
  173. data/.gs/gems/rake-10.5.0/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  174. data/.gs/gems/rake-10.5.0/lib/rake/contrib/sshpublisher.rb +61 -0
  175. data/.gs/gems/rake-10.5.0/lib/rake/contrib/sys.rb +4 -0
  176. data/.gs/gems/rake-10.5.0/lib/rake/cpu_counter.rb +125 -0
  177. data/.gs/gems/rake-10.5.0/lib/rake/default_loader.rb +14 -0
  178. data/.gs/gems/rake-10.5.0/lib/rake/dsl_definition.rb +201 -0
  179. data/.gs/gems/rake-10.5.0/lib/rake/early_time.rb +21 -0
  180. data/.gs/gems/rake-10.5.0/lib/rake/ext/core.rb +25 -0
  181. data/.gs/gems/rake-10.5.0/lib/rake/ext/module.rb +2 -0
  182. data/.gs/gems/rake-10.5.0/lib/rake/ext/pathname.rb +25 -0
  183. data/.gs/gems/rake-10.5.0/lib/rake/ext/string.rb +175 -0
  184. data/.gs/gems/rake-10.5.0/lib/rake/ext/time.rb +18 -0
  185. data/.gs/gems/rake-10.5.0/lib/rake/file_creation_task.rb +24 -0
  186. data/.gs/gems/rake-10.5.0/lib/rake/file_list.rb +428 -0
  187. data/.gs/gems/rake-10.5.0/lib/rake/file_task.rb +46 -0
  188. data/.gs/gems/rake-10.5.0/lib/rake/file_utils.rb +128 -0
  189. data/.gs/gems/rake-10.5.0/lib/rake/file_utils_ext.rb +144 -0
  190. data/.gs/gems/rake-10.5.0/lib/rake/gempackagetask.rb +4 -0
  191. data/.gs/gems/rake-10.5.0/lib/rake/invocation_chain.rb +56 -0
  192. data/.gs/gems/rake-10.5.0/lib/rake/invocation_exception_mixin.rb +16 -0
  193. data/.gs/gems/rake-10.5.0/lib/rake/late_time.rb +17 -0
  194. data/.gs/gems/rake-10.5.0/lib/rake/linked_list.rb +103 -0
  195. data/.gs/gems/rake-10.5.0/lib/rake/loaders/makefile.rb +53 -0
  196. data/.gs/gems/rake-10.5.0/lib/rake/multi_task.rb +13 -0
  197. data/.gs/gems/rake-10.5.0/lib/rake/name_space.rb +38 -0
  198. data/.gs/gems/rake-10.5.0/lib/rake/packagetask.rb +199 -0
  199. data/.gs/gems/rake-10.5.0/lib/rake/pathmap.rb +3 -0
  200. data/.gs/gems/rake-10.5.0/lib/rake/phony.rb +15 -0
  201. data/.gs/gems/rake-10.5.0/lib/rake/private_reader.rb +20 -0
  202. data/.gs/gems/rake-10.5.0/lib/rake/promise.rb +99 -0
  203. data/.gs/gems/rake-10.5.0/lib/rake/pseudo_status.rb +29 -0
  204. data/.gs/gems/rake-10.5.0/lib/rake/rake_module.rb +38 -0
  205. data/.gs/gems/rake-10.5.0/lib/rake/rake_test_loader.rb +22 -0
  206. data/.gs/gems/rake-10.5.0/lib/rake/rdoctask.rb +4 -0
  207. data/.gs/gems/rake-10.5.0/lib/rake/ruby182_test_unit_fix.rb +29 -0
  208. data/.gs/gems/rake-10.5.0/lib/rake/rule_recursion_overflow_error.rb +20 -0
  209. data/.gs/gems/rake-10.5.0/lib/rake/runtest.rb +27 -0
  210. data/.gs/gems/rake-10.5.0/lib/rake/scope.rb +42 -0
  211. data/.gs/gems/rake-10.5.0/lib/rake/task.rb +383 -0
  212. data/.gs/gems/rake-10.5.0/lib/rake/task_argument_error.rb +7 -0
  213. data/.gs/gems/rake-10.5.0/lib/rake/task_arguments.rb +98 -0
  214. data/.gs/gems/rake-10.5.0/lib/rake/task_manager.rb +307 -0
  215. data/.gs/gems/rake-10.5.0/lib/rake/tasklib.rb +24 -0
  216. data/.gs/gems/rake-10.5.0/lib/rake/testtask.rb +213 -0
  217. data/.gs/gems/rake-10.5.0/lib/rake/thread_history_display.rb +48 -0
  218. data/.gs/gems/rake-10.5.0/lib/rake/thread_pool.rb +164 -0
  219. data/.gs/gems/rake-10.5.0/lib/rake/trace_output.rb +22 -0
  220. data/.gs/gems/rake-10.5.0/lib/rake/version.rb +7 -0
  221. data/.gs/gems/rake-10.5.0/lib/rake/win32.rb +56 -0
  222. data/.gs/gems/rake-10.5.0/rakelib/publish.rake +20 -0
  223. data/.gs/gems/rake-10.5.0/rakelib/test_times.rake +25 -0
  224. data/.gs/gems/rake-10.5.0/test/file_creation.rb +34 -0
  225. data/.gs/gems/rake-10.5.0/test/helper.rb +129 -0
  226. data/.gs/gems/rake-10.5.0/test/support/rakefile_definitions.rb +478 -0
  227. data/.gs/gems/rake-10.5.0/test/support/ruby_runner.rb +34 -0
  228. data/.gs/gems/rake-10.5.0/test/test_private_reader.rb +42 -0
  229. data/.gs/gems/rake-10.5.0/test/test_rake.rb +40 -0
  230. data/.gs/gems/rake-10.5.0/test/test_rake_application.rb +643 -0
  231. data/.gs/gems/rake-10.5.0/test/test_rake_application_options.rb +468 -0
  232. data/.gs/gems/rake-10.5.0/test/test_rake_backtrace.rb +119 -0
  233. data/.gs/gems/rake-10.5.0/test/test_rake_clean.rb +61 -0
  234. data/.gs/gems/rake-10.5.0/test/test_rake_cpu_counter.rb +68 -0
  235. data/.gs/gems/rake-10.5.0/test/test_rake_definitions.rb +84 -0
  236. data/.gs/gems/rake-10.5.0/test/test_rake_directory_task.rb +76 -0
  237. data/.gs/gems/rake-10.5.0/test/test_rake_dsl.rb +40 -0
  238. data/.gs/gems/rake-10.5.0/test/test_rake_early_time.rb +31 -0
  239. data/.gs/gems/rake-10.5.0/test/test_rake_extension.rb +59 -0
  240. data/.gs/gems/rake-10.5.0/test/test_rake_file_creation_task.rb +56 -0
  241. data/.gs/gems/rake-10.5.0/test/test_rake_file_list.rb +670 -0
  242. data/.gs/gems/rake-10.5.0/test/test_rake_file_list_path_map.rb +8 -0
  243. data/.gs/gems/rake-10.5.0/test/test_rake_file_task.rb +197 -0
  244. data/.gs/gems/rake-10.5.0/test/test_rake_file_utils.rb +314 -0
  245. data/.gs/gems/rake-10.5.0/test/test_rake_ftp_file.rb +74 -0
  246. data/.gs/gems/rake-10.5.0/test/test_rake_functional.rb +482 -0
  247. data/.gs/gems/rake-10.5.0/test/test_rake_invocation_chain.rb +64 -0
  248. data/.gs/gems/rake-10.5.0/test/test_rake_late_time.rb +18 -0
  249. data/.gs/gems/rake-10.5.0/test/test_rake_linked_list.rb +84 -0
  250. data/.gs/gems/rake-10.5.0/test/test_rake_makefile_loader.rb +46 -0
  251. data/.gs/gems/rake-10.5.0/test/test_rake_multi_task.rb +64 -0
  252. data/.gs/gems/rake-10.5.0/test/test_rake_name_space.rb +57 -0
  253. data/.gs/gems/rake-10.5.0/test/test_rake_package_task.rb +79 -0
  254. data/.gs/gems/rake-10.5.0/test/test_rake_path_map.rb +168 -0
  255. data/.gs/gems/rake-10.5.0/test/test_rake_path_map_explode.rb +34 -0
  256. data/.gs/gems/rake-10.5.0/test/test_rake_path_map_partial.rb +18 -0
  257. data/.gs/gems/rake-10.5.0/test/test_rake_pathname_extensions.rb +15 -0
  258. data/.gs/gems/rake-10.5.0/test/test_rake_pseudo_status.rb +21 -0
  259. data/.gs/gems/rake-10.5.0/test/test_rake_rake_test_loader.rb +20 -0
  260. data/.gs/gems/rake-10.5.0/test/test_rake_reduce_compat.rb +26 -0
  261. data/.gs/gems/rake-10.5.0/test/test_rake_require.rb +40 -0
  262. data/.gs/gems/rake-10.5.0/test/test_rake_rules.rb +388 -0
  263. data/.gs/gems/rake-10.5.0/test/test_rake_scope.rb +44 -0
  264. data/.gs/gems/rake-10.5.0/test/test_rake_task.rb +393 -0
  265. data/.gs/gems/rake-10.5.0/test/test_rake_task_argument_parsing.rb +119 -0
  266. data/.gs/gems/rake-10.5.0/test/test_rake_task_arguments.rb +127 -0
  267. data/.gs/gems/rake-10.5.0/test/test_rake_task_lib.rb +9 -0
  268. data/.gs/gems/rake-10.5.0/test/test_rake_task_manager.rb +178 -0
  269. data/.gs/gems/rake-10.5.0/test/test_rake_task_manager_argument_resolution.rb +19 -0
  270. data/.gs/gems/rake-10.5.0/test/test_rake_task_with_arguments.rb +172 -0
  271. data/.gs/gems/rake-10.5.0/test/test_rake_test_task.rb +146 -0
  272. data/.gs/gems/rake-10.5.0/test/test_rake_thread_pool.rb +145 -0
  273. data/.gs/gems/rake-10.5.0/test/test_rake_top_level_functions.rb +71 -0
  274. data/.gs/gems/rake-10.5.0/test/test_rake_win32.rb +72 -0
  275. data/.gs/gems/rake-10.5.0/test/test_thread_history_display.rb +101 -0
  276. data/.gs/gems/rake-10.5.0/test/test_trace_output.rb +52 -0
  277. data/.gs/specifications/faraday-0.9.2.gemspec +31 -0
  278. data/.gs/specifications/minitest-5.9.0.gemspec +39 -0
  279. data/.gs/specifications/multi_json-1.12.1.gemspec +33 -0
  280. data/.gs/specifications/multipart-post-2.0.0.gemspec +22 -0
  281. data/.gs/specifications/rake-10.5.0.gemspec +43 -0
  282. data/.rubocop.yml +36 -0
  283. data/.ruby-version +1 -0
  284. data/.travis.yml +7 -0
  285. data/CODE_OF_CONDUCT.md +49 -0
  286. data/Gemfile +10 -0
  287. data/LICENSE.txt +21 -0
  288. data/README.md +35 -0
  289. data/Rakefile +38 -0
  290. data/bin/console +14 -0
  291. data/bin/setup +8 -0
  292. data/lib/mercadopago/core/client.rb +70 -0
  293. data/lib/mercadopago/core/endpoints.rb +134 -0
  294. data/lib/mercadopago/core/errors.rb +6 -0
  295. data/lib/mercadopago/core/gateway.rb +84 -0
  296. data/lib/mercadopago/custom_checkout.rb +29 -0
  297. data/lib/mercadopago/custom_checkout/account.rb +162 -0
  298. data/lib/mercadopago/custom_checkout/card_issuer.rb +20 -0
  299. data/lib/mercadopago/custom_checkout/card_token.rb +57 -0
  300. data/lib/mercadopago/custom_checkout/customer.rb +84 -0
  301. data/lib/mercadopago/custom_checkout/errors.rb +6 -0
  302. data/lib/mercadopago/custom_checkout/identification_type.rb +19 -0
  303. data/lib/mercadopago/custom_checkout/payment_method.rb +42 -0
  304. data/lib/mercadopago/custom_checkout/payments.rb +24 -0
  305. data/lib/mercadopago/custom_checkout/resource.rb +14 -0
  306. data/lib/mercadopago/custom_checkout/version.rb +5 -0
  307. data/mercadopago-custom-checkout.gemspec +30 -0
  308. metadata +455 -0
@@ -0,0 +1,45 @@
1
+ # :stopdoc:
2
+
3
+ unless defined?(Minitest) then
4
+ # all of this crap is just to avoid circular requires and is only
5
+ # needed if a user requires "minitest/unit" directly instead of
6
+ # "minitest/autorun", so we also warn
7
+
8
+ from = caller.reject { |s| s =~ /rubygems/ }.join("\n ")
9
+ warn "Warning: you should require 'minitest/autorun' instead."
10
+ warn %(Warning: or add 'gem "minitest"' before 'require "minitest/autorun"')
11
+ warn "From:\n #{from}"
12
+
13
+ module Minitest; end
14
+ MiniTest = Minitest # prevents minitest.rb from requiring back to us
15
+ require "minitest"
16
+ end
17
+
18
+ MiniTest = Minitest unless defined?(MiniTest)
19
+
20
+ module Minitest
21
+ class Unit
22
+ VERSION = Minitest::VERSION
23
+ class TestCase < Minitest::Test
24
+ def self.inherited klass # :nodoc:
25
+ from = caller.first
26
+ warn "MiniTest::Unit::TestCase is now Minitest::Test. From #{from}"
27
+ super
28
+ end
29
+ end
30
+
31
+ def self.autorun # :nodoc:
32
+ from = caller.first
33
+ warn "MiniTest::Unit.autorun is now Minitest.autorun. From #{from}"
34
+ Minitest.autorun
35
+ end
36
+
37
+ def self.after_tests(&b) # :nodoc:
38
+ from = caller.first
39
+ warn "MiniTest::Unit.after_tests is now Minitest.after_run. From #{from}"
40
+ Minitest.after_run(&b)
41
+ end
42
+ end
43
+ end
44
+
45
+ # :startdoc:
@@ -0,0 +1,90 @@
1
+ require "tempfile"
2
+ require "stringio"
3
+ require "minitest/autorun"
4
+
5
+ class Minitest::Test
6
+ def clean s
7
+ s.gsub(/^ {6}/, "")
8
+ end
9
+ end
10
+
11
+ class MetaMetaMetaTestCase < Minitest::Test
12
+ attr_accessor :reporter, :output, :tu
13
+
14
+ def run_tu_with_fresh_reporter flags = %w[--seed 42]
15
+ options = Minitest.process_args flags
16
+
17
+ @output = StringIO.new("")
18
+
19
+ self.reporter = Minitest::CompositeReporter.new
20
+ reporter << Minitest::SummaryReporter.new(@output, options)
21
+ reporter << Minitest::ProgressReporter.new(@output, options)
22
+
23
+ reporter.start
24
+
25
+ yield(reporter) if block_given?
26
+
27
+ @tus ||= [@tu]
28
+ @tus.each do |tu|
29
+ Minitest::Runnable.runnables.delete tu
30
+
31
+ tu.run reporter, options
32
+ end
33
+
34
+ reporter.report
35
+ end
36
+
37
+ def first_reporter
38
+ reporter.reporters.first
39
+ end
40
+
41
+ def assert_report expected, flags = %w[--seed 42], &block
42
+ header = clean <<-EOM
43
+ Run options: #{flags.map { |s| s =~ /\|/ ? s.inspect : s }.join " "}
44
+
45
+ # Running:
46
+
47
+ EOM
48
+
49
+ run_tu_with_fresh_reporter flags, &block
50
+
51
+ output = normalize_output @output.string.dup
52
+
53
+ assert_equal header + expected, output
54
+ end
55
+
56
+ def normalize_output output
57
+ output.sub!(/Finished in .*/, "Finished in 0.00")
58
+ output.sub!(/Loaded suite .*/, "Loaded suite blah")
59
+
60
+ output.gsub!(/ = \d+.\d\d s = /, " = 0.00 s = ")
61
+ output.gsub!(/0x[A-Fa-f0-9]+/, "0xXXX")
62
+ output.gsub!(/ +$/, "")
63
+
64
+ if windows? then
65
+ output.gsub!(/\[(?:[A-Za-z]:)?[^\]:]+:\d+\]/, "[FILE:LINE]")
66
+ output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in/, '\1FILE:LINE:in')
67
+ else
68
+ output.gsub!(/\[[^\]:]+:\d+\]/, "[FILE:LINE]")
69
+ output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
70
+ end
71
+
72
+ output
73
+ end
74
+
75
+ def restore_env
76
+ old_value = ENV["MT_NO_SKIP_MSG"]
77
+ ENV.delete "MT_NO_SKIP_MSG"
78
+
79
+ yield
80
+ ensure
81
+ ENV["MT_NO_SKIP_MSG"] = old_value
82
+ end
83
+
84
+ def setup
85
+ super
86
+ srand 42
87
+ Minitest::Test.reset
88
+ @tu = nil
89
+ end
90
+ end
@@ -0,0 +1,137 @@
1
+ require "minitest/autorun"
2
+ require "minitest/benchmark"
3
+
4
+ ##
5
+ # Used to verify data:
6
+ # http://www.wolframalpha.com/examples/RegressionAnalysis.html
7
+
8
+ class TestMinitestBenchmark < Minitest::Test
9
+ def test_cls_bench_exp
10
+ assert_equal [2, 4, 8, 16, 32], Minitest::Benchmark.bench_exp(2, 32, 2)
11
+ end
12
+
13
+ def test_cls_bench_linear
14
+ assert_equal [2, 4, 6, 8, 10], Minitest::Benchmark.bench_linear(2, 10, 2)
15
+ end
16
+
17
+ def test_cls_runnable_methods
18
+ assert_equal [], Minitest::Benchmark.runnable_methods
19
+
20
+ c = Class.new(Minitest::Benchmark) do
21
+ def bench_blah
22
+ end
23
+ end
24
+
25
+ assert_equal ["bench_blah"], c.runnable_methods
26
+ end
27
+
28
+ def test_cls_bench_range
29
+ assert_equal [1, 10, 100, 1_000, 10_000], Minitest::Benchmark.bench_range
30
+ end
31
+
32
+ def test_fit_exponential_clean
33
+ x = [1.0, 2.0, 3.0, 4.0, 5.0]
34
+ y = x.map { |n| 1.1 * Math.exp(2.1 * n) }
35
+
36
+ assert_fit :exponential, x, y, 1.0, 1.1, 2.1
37
+ end
38
+
39
+ def test_fit_exponential_noisy
40
+ x = [1.0, 1.9, 2.6, 3.4, 5.0]
41
+ y = [12, 10, 8.2, 6.9, 5.9]
42
+
43
+ # verified with Numbers and R
44
+ assert_fit :exponential, x, y, 0.95, 13.81148, -0.1820
45
+ end
46
+
47
+ def test_fit_logarithmic_clean
48
+ x = [1.0, 2.0, 3.0, 4.0, 5.0]
49
+ y = x.map { |n| 1.1 + 2.1 * Math.log(n) }
50
+
51
+ assert_fit :logarithmic, x, y, 1.0, 1.1, 2.1
52
+ end
53
+
54
+ def test_fit_logarithmic_noisy
55
+ x = [1.0, 2.0, 3.0, 4.0, 5.0]
56
+ # Generated with
57
+ # y = x.map { |n| jitter = 0.999 + 0.002 * rand; (Math.log(n) ) * jitter }
58
+ y = [0.0, 0.6935, 1.0995, 1.3873, 1.6097]
59
+
60
+ assert_fit :logarithmic, x, y, 0.95, 0, 1
61
+ end
62
+
63
+ def test_fit_constant_clean
64
+ x = (1..5).to_a
65
+ y = [5.0, 5.0, 5.0, 5.0, 5.0]
66
+
67
+ assert_fit :linear, x, y, nil, 5.0, 0
68
+ end
69
+
70
+ def test_fit_constant_noisy
71
+ x = (1..5).to_a
72
+ y = [1.0, 1.2, 1.0, 0.8, 1.0]
73
+
74
+ # verified in numbers and R
75
+ assert_fit :linear, x, y, nil, 1.12, -0.04
76
+ end
77
+
78
+ def test_fit_linear_clean
79
+ # y = m * x + b where m = 2.2, b = 3.1
80
+ x = (1..5).to_a
81
+ y = x.map { |n| 2.2 * n + 3.1 }
82
+
83
+ assert_fit :linear, x, y, 1.0, 3.1, 2.2
84
+ end
85
+
86
+ def test_fit_linear_noisy
87
+ x = [ 60, 61, 62, 63, 65]
88
+ y = [3.1, 3.6, 3.8, 4.0, 4.1]
89
+
90
+ # verified in numbers and R
91
+ assert_fit :linear, x, y, 0.8315, -7.9635, 0.1878
92
+ end
93
+
94
+ def test_fit_power_clean
95
+ # y = A x ** B, where B = b and A = e ** a
96
+ # if, A = 1, B = 2, then
97
+
98
+ x = [1.0, 2.0, 3.0, 4.0, 5.0]
99
+ y = [1.0, 4.0, 9.0, 16.0, 25.0]
100
+
101
+ assert_fit :power, x, y, 1.0, 1.0, 2.0
102
+ end
103
+
104
+ def test_fit_power_noisy
105
+ # from www.engr.uidaho.edu/thompson/courses/ME330/lecture/least_squares.html
106
+ x = [10, 12, 15, 17, 20, 22, 25, 27, 30, 32, 35]
107
+ y = [95, 105, 125, 141, 173, 200, 253, 298, 385, 459, 602]
108
+
109
+ # verified in numbers
110
+ assert_fit :power, x, y, 0.90, 2.6217, 1.4556
111
+
112
+ # income to % of households below income amount
113
+ # http://library.wolfram.com/infocenter/Conferences/6461/PowerLaws.nb
114
+ x = [15_000, 25_000, 35_000, 50_000, 75_000, 100_000]
115
+ y = [0.154, 0.283, 0.402, 0.55, 0.733, 0.843]
116
+
117
+ # verified in numbers
118
+ assert_fit :power, x, y, 0.96, 3.119e-5, 0.8959
119
+ end
120
+
121
+ def assert_fit msg, x, y, fit, exp_a, exp_b
122
+ bench = Minitest::Benchmark.new :blah
123
+
124
+ a, b, rr = bench.send "fit_#{msg}", x, y
125
+
126
+ assert_operator rr, :>=, fit if fit
127
+ assert_in_delta exp_a, a
128
+ assert_in_delta exp_b, b
129
+ end
130
+ end
131
+
132
+ describe "my class Bench" do
133
+ klass = self
134
+ it "should provide bench methods" do
135
+ klass.must_respond_to :bench
136
+ end
137
+ end
@@ -0,0 +1,512 @@
1
+ require "minitest/autorun"
2
+
3
+ class TestMinitestMock < Minitest::Test
4
+ parallelize_me!
5
+
6
+ def setup
7
+ @mock = Minitest::Mock.new.expect(:foo, nil)
8
+ @mock.expect(:meaning_of_life, 42)
9
+ end
10
+
11
+ def test_create_stub_method
12
+ assert_nil @mock.foo
13
+ end
14
+
15
+ def test_allow_return_value_specification
16
+ assert_equal 42, @mock.meaning_of_life
17
+ end
18
+
19
+ def test_blow_up_if_not_called
20
+ @mock.foo
21
+
22
+ util_verify_bad "expected meaning_of_life() => 42"
23
+ end
24
+
25
+ def test_not_blow_up_if_everything_called
26
+ @mock.foo
27
+ @mock.meaning_of_life
28
+
29
+ assert_mock @mock
30
+ end
31
+
32
+ def test_allow_expectations_to_be_added_after_creation
33
+ @mock.expect(:bar, true)
34
+ assert @mock.bar
35
+ end
36
+
37
+ def test_not_verify_if_new_expected_method_is_not_called
38
+ @mock.foo
39
+ @mock.meaning_of_life
40
+ @mock.expect(:bar, true)
41
+
42
+ util_verify_bad "expected bar() => true"
43
+ end
44
+
45
+ def test_blow_up_on_wrong_number_of_arguments
46
+ @mock.foo
47
+ @mock.meaning_of_life
48
+ @mock.expect(:sum, 3, [1, 2])
49
+
50
+ e = assert_raises ArgumentError do
51
+ @mock.sum
52
+ end
53
+
54
+ assert_equal "mocked method :sum expects 2 arguments, got 0", e.message
55
+ end
56
+
57
+ def test_return_mock_does_not_raise
58
+ retval = Minitest::Mock.new
59
+ mock = Minitest::Mock.new
60
+ mock.expect(:foo, retval)
61
+ mock.foo
62
+
63
+ assert_mock mock
64
+ end
65
+
66
+ def test_mock_args_does_not_raise
67
+ skip "non-opaque use of ==" if maglev?
68
+
69
+ arg = Minitest::Mock.new
70
+ mock = Minitest::Mock.new
71
+ mock.expect(:foo, nil, [arg])
72
+ mock.foo(arg)
73
+
74
+ assert_mock mock
75
+ end
76
+
77
+ def test_set_expectation_on_special_methods
78
+ mock = Minitest::Mock.new
79
+
80
+ mock.expect :object_id, "received object_id"
81
+ assert_equal "received object_id", mock.object_id
82
+
83
+ mock.expect :respond_to_missing?, "received respond_to_missing?"
84
+ assert_equal "received respond_to_missing?", mock.respond_to_missing?
85
+
86
+ mock.expect :===, "received ==="
87
+ assert_equal "received ===", mock.===
88
+
89
+ mock.expect :inspect, "received inspect"
90
+ assert_equal "received inspect", mock.inspect
91
+
92
+ mock.expect :to_s, "received to_s"
93
+ assert_equal "received to_s", mock.to_s
94
+
95
+ mock.expect :public_send, "received public_send"
96
+ assert_equal "received public_send", mock.public_send
97
+
98
+ mock.expect :send, "received send"
99
+ assert_equal "received send", mock.send
100
+
101
+ assert_mock mock
102
+ end
103
+
104
+ def test_expectations_can_be_satisfied_via_send
105
+ @mock.send :foo
106
+ @mock.send :meaning_of_life
107
+
108
+ assert_mock @mock
109
+ end
110
+
111
+ def test_expectations_can_be_satisfied_via_public_send
112
+ skip "Doesn't run on 1.8" if RUBY_VERSION < "1.9"
113
+
114
+ @mock.public_send :foo
115
+ @mock.public_send :meaning_of_life
116
+
117
+ assert_mock @mock
118
+ end
119
+
120
+ def test_blow_up_on_wrong_arguments
121
+ @mock.foo
122
+ @mock.meaning_of_life
123
+ @mock.expect(:sum, 3, [1, 2])
124
+
125
+ e = assert_raises MockExpectationError do
126
+ @mock.sum(2, 4)
127
+ end
128
+
129
+ exp = "mocked method :sum called with unexpected arguments [2, 4]"
130
+ assert_equal exp, e.message
131
+ end
132
+
133
+ def test_expect_with_non_array_args
134
+ e = assert_raises ArgumentError do
135
+ @mock.expect :blah, 3, false
136
+ end
137
+
138
+ assert_equal "args must be an array", e.message
139
+ end
140
+
141
+ def test_respond_appropriately
142
+ assert @mock.respond_to?(:foo)
143
+ assert @mock.respond_to?(:foo, true)
144
+ assert @mock.respond_to?("foo")
145
+ assert !@mock.respond_to?(:bar)
146
+ end
147
+
148
+ def test_no_method_error_on_unexpected_methods
149
+ e = assert_raises NoMethodError do
150
+ @mock.bar
151
+ end
152
+
153
+ expected = "unmocked method :bar, expected one of [:foo, :meaning_of_life]"
154
+
155
+ assert_equal expected, e.message
156
+ end
157
+
158
+ def test_assign_per_mock_return_values
159
+ a = Minitest::Mock.new
160
+ b = Minitest::Mock.new
161
+
162
+ a.expect(:foo, :a)
163
+ b.expect(:foo, :b)
164
+
165
+ assert_equal :a, a.foo
166
+ assert_equal :b, b.foo
167
+ end
168
+
169
+ def test_do_not_create_stub_method_on_new_mocks
170
+ a = Minitest::Mock.new
171
+ a.expect(:foo, :a)
172
+
173
+ assert !Minitest::Mock.new.respond_to?(:foo)
174
+ end
175
+
176
+ def test_mock_is_a_blank_slate
177
+ @mock.expect :kind_of?, true, [Fixnum]
178
+ @mock.expect :==, true, [1]
179
+
180
+ assert @mock.kind_of?(Fixnum), "didn't mock :kind_of\?"
181
+ assert @mock == 1, "didn't mock :=="
182
+ end
183
+
184
+ def test_verify_allows_called_args_to_be_loosely_specified
185
+ mock = Minitest::Mock.new
186
+ mock.expect :loose_expectation, true, [Integer]
187
+ mock.loose_expectation 1
188
+
189
+ assert_mock mock
190
+ end
191
+
192
+ def test_verify_raises_with_strict_args
193
+ mock = Minitest::Mock.new
194
+ mock.expect :strict_expectation, true, [2]
195
+
196
+ e = assert_raises MockExpectationError do
197
+ mock.strict_expectation 1
198
+ end
199
+
200
+ exp = "mocked method :strict_expectation called with unexpected arguments [1]"
201
+ assert_equal exp, e.message
202
+ end
203
+
204
+ def test_method_missing_empty
205
+ mock = Minitest::Mock.new
206
+
207
+ mock.expect :a, nil
208
+
209
+ mock.a
210
+
211
+ e = assert_raises MockExpectationError do
212
+ mock.a
213
+ end
214
+
215
+ assert_equal "No more expects available for :a: []", e.message
216
+ end
217
+
218
+ def test_same_method_expects_are_verified_when_all_called
219
+ mock = Minitest::Mock.new
220
+ mock.expect :foo, nil, [:bar]
221
+ mock.expect :foo, nil, [:baz]
222
+
223
+ mock.foo :bar
224
+ mock.foo :baz
225
+
226
+ assert_mock mock
227
+ end
228
+
229
+ def test_same_method_expects_blow_up_when_not_all_called
230
+ mock = Minitest::Mock.new
231
+ mock.expect :foo, nil, [:bar]
232
+ mock.expect :foo, nil, [:baz]
233
+
234
+ mock.foo :bar
235
+
236
+ e = assert_raises(MockExpectationError) { mock.verify }
237
+
238
+ exp = "expected foo(:baz) => nil, got [foo(:bar) => nil]"
239
+
240
+ assert_equal exp, e.message
241
+ end
242
+
243
+ def test_same_method_expects_with_same_args_blow_up_when_not_all_called
244
+ mock = Minitest::Mock.new
245
+ mock.expect :foo, nil, [:bar]
246
+ mock.expect :foo, nil, [:bar]
247
+
248
+ mock.foo :bar
249
+
250
+ e = assert_raises(MockExpectationError) { mock.verify }
251
+
252
+ exp = "expected foo(:bar) => nil, got [foo(:bar) => nil]"
253
+
254
+ assert_equal exp, e.message
255
+ end
256
+
257
+ def test_verify_passes_when_mock_block_returns_true
258
+ mock = Minitest::Mock.new
259
+ mock.expect :foo, nil do
260
+ true
261
+ end
262
+
263
+ mock.foo
264
+
265
+ assert_mock mock
266
+ end
267
+
268
+ def test_mock_block_is_passed_function_params
269
+ arg1, arg2, arg3 = :bar, [1, 2, 3], { :a => "a" }
270
+ mock = Minitest::Mock.new
271
+ mock.expect :foo, nil do |a1, a2, a3|
272
+ a1 == arg1 && a2 == arg2 && a3 == arg3
273
+ end
274
+
275
+ mock.foo arg1, arg2, arg3
276
+
277
+ assert_mock mock
278
+ end
279
+
280
+ def test_mock_block_is_passed_function_block
281
+ mock = Minitest::Mock.new
282
+ block = proc { "bar" }
283
+ mock.expect :foo, nil do |arg, &blk|
284
+ arg == "foo" &&
285
+ blk == block
286
+ end
287
+ mock.foo "foo", &block
288
+ assert_mock mock
289
+ end
290
+
291
+ def test_verify_fails_when_mock_block_returns_false
292
+ mock = Minitest::Mock.new
293
+ mock.expect :foo, nil do
294
+ false
295
+ end
296
+
297
+ e = assert_raises(MockExpectationError) { mock.foo }
298
+ exp = "mocked method :foo failed block w/ []"
299
+
300
+ assert_equal exp, e.message
301
+ end
302
+
303
+ def test_mock_block_throws_if_args_passed
304
+ mock = Minitest::Mock.new
305
+
306
+ e = assert_raises(ArgumentError) do
307
+ mock.expect :foo, nil, [:a, :b, :c] do
308
+ true
309
+ end
310
+ end
311
+
312
+ exp = "args ignored when block given"
313
+
314
+ assert_equal exp, e.message
315
+ end
316
+
317
+ def test_mock_returns_retval_when_called_with_block
318
+ mock = Minitest::Mock.new
319
+ mock.expect(:foo, 32) do
320
+ true
321
+ end
322
+
323
+ rs = mock.foo
324
+
325
+ assert_equal rs, 32
326
+ end
327
+
328
+ def util_verify_bad exp
329
+ e = assert_raises MockExpectationError do
330
+ @mock.verify
331
+ end
332
+
333
+ assert_equal exp, e.message
334
+ end
335
+
336
+ def test_mock_called_via_send
337
+ mock = Minitest::Mock.new
338
+ mock.expect(:foo, true)
339
+
340
+ mock.send :foo
341
+ assert_mock mock
342
+ end
343
+
344
+ def test_mock_called_via___send__
345
+ mock = Minitest::Mock.new
346
+ mock.expect(:foo, true)
347
+
348
+ mock.__send__ :foo
349
+ assert_mock mock
350
+ end
351
+
352
+ def test_mock_called_via_send_with_args
353
+ mock = Minitest::Mock.new
354
+ mock.expect(:foo, true, [1, 2, 3])
355
+
356
+ mock.send(:foo, 1, 2, 3)
357
+ assert_mock mock
358
+ end
359
+
360
+ end
361
+
362
+ require "minitest/metametameta"
363
+
364
+ class TestMinitestStub < Minitest::Test
365
+ parallelize_me!
366
+
367
+ def setup
368
+ super
369
+ Minitest::Test.reset
370
+
371
+ @tc = Minitest::Test.new "fake tc"
372
+ @assertion_count = 1
373
+ end
374
+
375
+ def teardown
376
+ super
377
+ assert_equal @assertion_count, @tc.assertions
378
+ end
379
+
380
+ class Time
381
+ def self.now
382
+ 24
383
+ end
384
+ end
385
+
386
+ def assert_stub val_or_callable
387
+ @assertion_count += 1
388
+
389
+ t = Time.now.to_i
390
+
391
+ Time.stub :now, val_or_callable do
392
+ @tc.assert_equal 42, Time.now
393
+ end
394
+
395
+ @tc.assert_operator Time.now.to_i, :>=, t
396
+ end
397
+
398
+ def test_stub_private_module_method
399
+ @assertion_count += 1
400
+
401
+ t0 = Time.now
402
+
403
+ self.stub :sleep, nil do
404
+ @tc.assert_nil sleep(10)
405
+ end
406
+
407
+ @tc.assert_operator Time.now - t0, :<=, 1
408
+ end
409
+
410
+ def test_stub_private_module_method_indirect
411
+ @assertion_count += 1
412
+
413
+ fail_clapper = Class.new do
414
+ def fail_clap
415
+ raise
416
+ :clap
417
+ end
418
+ end.new
419
+
420
+ fail_clapper.stub :raise, nil do |safe_clapper|
421
+ @tc.assert_equal :clap, safe_clapper.fail_clap # either form works
422
+ @tc.assert_equal :clap, fail_clapper.fail_clap # yay closures
423
+ end
424
+ end
425
+
426
+ def test_stub_public_module_method
427
+ Math.stub :log10, :stubbed do
428
+ @tc.assert_equal :stubbed, Math.log10(1000)
429
+ end
430
+ end
431
+
432
+ def test_stub_value
433
+ assert_stub 42
434
+ end
435
+
436
+ def test_stub_block
437
+ assert_stub lambda { 42 }
438
+ end
439
+
440
+ def test_stub_block_args
441
+ @assertion_count += 1
442
+
443
+ t = Time.now.to_i
444
+
445
+ Time.stub :now, lambda { |n| n * 2 } do
446
+ @tc.assert_equal 42, Time.now(21)
447
+ end
448
+
449
+ @tc.assert_operator Time.now.to_i, :>=, t
450
+ end
451
+
452
+ def test_stub_callable
453
+ obj = Object.new
454
+
455
+ def obj.call
456
+ 42
457
+ end
458
+
459
+ assert_stub obj
460
+ end
461
+
462
+ def test_stub_yield_self
463
+ obj = "foo"
464
+
465
+ val = obj.stub :to_s, "bar" do |s|
466
+ s.to_s
467
+ end
468
+
469
+ @tc.assert_equal "bar", val
470
+ end
471
+
472
+ def test_dynamic_method
473
+ @assertion_count = 2
474
+
475
+ dynamic = Class.new do
476
+ def self.respond_to?(meth)
477
+ meth == :found
478
+ end
479
+
480
+ def self.method_missing(meth, *args, &block)
481
+ if meth == :found
482
+ false
483
+ else
484
+ super
485
+ end
486
+ end
487
+ end
488
+
489
+ val = dynamic.stub(:found, true) do |s|
490
+ s.found
491
+ end
492
+
493
+ @tc.assert_equal true, val
494
+ @tc.assert_equal false, dynamic.found
495
+ end
496
+
497
+ def test_mock_with_yield
498
+ mock = Minitest::Mock.new
499
+ mock.expect(:write, true) do
500
+ true
501
+ end
502
+ rs = nil
503
+
504
+ File.stub(:open, true, mock) do
505
+ File.open("foo.txt", "r") do |f|
506
+ rs = f.write
507
+ end
508
+ end
509
+ @tc.assert_equal true, rs
510
+ end
511
+
512
+ end