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,1983 @@
1
+ # encoding: UTF-8
2
+
3
+ require "pathname"
4
+ require "minitest/metametameta"
5
+
6
+ module MyModule; end
7
+ class AnError < StandardError; include MyModule; end
8
+ class ImmutableString < String; def inspect; super.freeze; end; end
9
+ SomeError = Class.new Exception
10
+
11
+ class TestMinitestUnit < MetaMetaMetaTestCase
12
+ parallelize_me!
13
+
14
+ pwd = Pathname.new File.expand_path Dir.pwd
15
+ basedir = Pathname.new(File.expand_path "lib/minitest") + "mini"
16
+ basedir = basedir.relative_path_from(pwd).to_s
17
+ MINITEST_BASE_DIR = basedir[/\A\./] ? basedir : "./#{basedir}"
18
+ BT_MIDDLE = ["#{MINITEST_BASE_DIR}/test.rb:161:in `each'",
19
+ "#{MINITEST_BASE_DIR}/test.rb:158:in `each'",
20
+ "#{MINITEST_BASE_DIR}/test.rb:139:in `run'",
21
+ "#{MINITEST_BASE_DIR}/test.rb:106:in `run'"]
22
+
23
+ def test_filter_backtrace
24
+ # this is a semi-lame mix of relative paths.
25
+ # I cheated by making the autotest parts not have ./
26
+ bt = (["lib/autotest.rb:571:in `add_exception'",
27
+ "test/test_autotest.rb:62:in `test_add_exception'",
28
+ "#{MINITEST_BASE_DIR}/test.rb:165:in `__send__'"] +
29
+ BT_MIDDLE +
30
+ ["#{MINITEST_BASE_DIR}/test.rb:29",
31
+ "test/test_autotest.rb:422"])
32
+ bt = util_expand_bt bt
33
+
34
+ ex = ["lib/autotest.rb:571:in `add_exception'",
35
+ "test/test_autotest.rb:62:in `test_add_exception'"]
36
+ ex = util_expand_bt ex
37
+
38
+ fu = Minitest.filter_backtrace(bt)
39
+
40
+ assert_equal ex, fu
41
+ end
42
+
43
+ def test_filter_backtrace_all_unit
44
+ bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in `__send__'"] +
45
+ BT_MIDDLE +
46
+ ["#{MINITEST_BASE_DIR}/test.rb:29"])
47
+ ex = bt.clone
48
+ fu = Minitest.filter_backtrace(bt)
49
+ assert_equal ex, fu
50
+ end
51
+
52
+ def test_filter_backtrace_unit_starts
53
+ bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in `__send__'"] +
54
+ BT_MIDDLE +
55
+ ["#{MINITEST_BASE_DIR}/mini/test.rb:29",
56
+ "-e:1"])
57
+
58
+ bt = util_expand_bt bt
59
+
60
+ ex = ["-e:1"]
61
+ fu = Minitest.filter_backtrace bt
62
+ assert_equal ex, fu
63
+ end
64
+
65
+ # def test_default_runner_is_minitest_unit
66
+ # assert_instance_of Minitest::Unit, Minitest::Unit.runner
67
+ # end
68
+
69
+ def test_passed_eh_teardown_good
70
+ test_class = Class.new Minitest::Test do
71
+ def teardown; assert true; end
72
+ def test_omg; assert true; end
73
+ end
74
+
75
+ test = test_class.new :test_omg
76
+ test.run
77
+ assert test.passed?
78
+ end
79
+
80
+ def test_passed_eh_teardown_skipped
81
+ test_class = Class.new Minitest::Test do
82
+ def teardown; assert true; end
83
+ def test_omg; skip "bork"; end
84
+ end
85
+
86
+ test = test_class.new :test_omg
87
+ test.run
88
+
89
+ assert test.skipped?
90
+ refute test.passed?
91
+ end
92
+
93
+ def test_passed_eh_teardown_flunked
94
+ test_class = Class.new Minitest::Test do
95
+ def teardown; flunk; end
96
+ def test_omg; assert true; end
97
+ end
98
+
99
+ test = test_class.new :test_omg
100
+ test.run
101
+ refute test.passed?
102
+ end
103
+
104
+ def util_expand_bt bt
105
+ if RUBY_VERSION >= "1.9.0" then
106
+ bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
107
+ else
108
+ bt
109
+ end
110
+ end
111
+ end
112
+
113
+ class TestMinitestUnitInherited < MetaMetaMetaTestCase
114
+ def with_overridden_include
115
+ Class.class_eval do
116
+ def inherited_with_hacks _klass
117
+ throw :inherited_hook
118
+ end
119
+
120
+ alias inherited_without_hacks inherited
121
+ alias inherited inherited_with_hacks
122
+ alias IGNORE_ME! inherited # 1.8 bug. god I love venture bros
123
+ end
124
+
125
+ yield
126
+ ensure
127
+ Class.class_eval do
128
+ alias inherited inherited_without_hacks
129
+
130
+ undef_method :inherited_with_hacks
131
+ undef_method :inherited_without_hacks
132
+ end
133
+
134
+ refute_respond_to Class, :inherited_with_hacks
135
+ refute_respond_to Class, :inherited_without_hacks
136
+ end
137
+
138
+ def test_inherited_hook_plays_nice_with_others
139
+ with_overridden_include do
140
+ assert_throws :inherited_hook do
141
+ Class.new Minitest::Test
142
+ end
143
+ end
144
+ end
145
+ end
146
+
147
+ class TestMinitestRunner < MetaMetaMetaTestCase
148
+ # do not parallelize this suite... it just can't handle it.
149
+
150
+ def test_class_runnables
151
+ @assertion_count = 0
152
+
153
+ tc = Class.new(Minitest::Test)
154
+
155
+ assert_equal 1, Minitest::Test.runnables.size
156
+ assert_equal [tc], Minitest::Test.runnables
157
+ end
158
+
159
+ def test_run_test
160
+ @tu =
161
+ Class.new Minitest::Test do
162
+ attr_reader :foo
163
+
164
+ def run
165
+ @foo = "hi mom!"
166
+ super
167
+ @foo = "okay"
168
+
169
+ self # per contract
170
+ end
171
+
172
+ def test_something
173
+ assert_equal "hi mom!", foo
174
+ end
175
+ end
176
+
177
+ expected = clean <<-EOM
178
+ .
179
+
180
+ Finished in 0.00
181
+
182
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
183
+ EOM
184
+
185
+ assert_report expected
186
+ end
187
+
188
+ def test_run_error
189
+ @tu =
190
+ Class.new Minitest::Test do
191
+ def test_something
192
+ assert true
193
+ end
194
+
195
+ def test_error
196
+ raise "unhandled exception"
197
+ end
198
+ end
199
+
200
+ expected = clean <<-EOM
201
+ E.
202
+
203
+ Finished in 0.00
204
+
205
+ 1) Error:
206
+ #<Class:0xXXX>#test_error:
207
+ RuntimeError: unhandled exception
208
+ FILE:LINE:in \`test_error\'
209
+
210
+ 2 runs, 1 assertions, 0 failures, 1 errors, 0 skips
211
+ EOM
212
+
213
+ assert_report expected
214
+ end
215
+
216
+ def test_run_error_teardown
217
+ @tu =
218
+ Class.new Minitest::Test do
219
+ def test_something
220
+ assert true
221
+ end
222
+
223
+ def teardown
224
+ raise "unhandled exception"
225
+ end
226
+ end
227
+
228
+ expected = clean <<-EOM
229
+ E
230
+
231
+ Finished in 0.00
232
+
233
+ 1) Error:
234
+ #<Class:0xXXX>#test_something:
235
+ RuntimeError: unhandled exception
236
+ FILE:LINE:in \`teardown\'
237
+
238
+ 1 runs, 1 assertions, 0 failures, 1 errors, 0 skips
239
+ EOM
240
+
241
+ assert_report expected
242
+ end
243
+
244
+ def test_run_failing
245
+ setup_basic_tu
246
+
247
+ expected = clean <<-EOM
248
+ F.
249
+
250
+ Finished in 0.00
251
+
252
+ 1) Failure:
253
+ #<Class:0xXXX>#test_failure [FILE:LINE]:
254
+ Expected false to be truthy.
255
+
256
+ 2 runs, 2 assertions, 1 failures, 0 errors, 0 skips
257
+ EOM
258
+
259
+ assert_report expected
260
+ end
261
+
262
+ def setup_basic_tu
263
+ @tu =
264
+ Class.new Minitest::Test do
265
+ def test_something
266
+ assert true
267
+ end
268
+
269
+ def test_failure
270
+ assert false
271
+ end
272
+ end
273
+ end
274
+
275
+ def test_run_failing_filtered
276
+ setup_basic_tu
277
+
278
+ expected = clean <<-EOM
279
+ .
280
+
281
+ Finished in 0.00
282
+
283
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
284
+ EOM
285
+
286
+ assert_report expected, %w[--name /some|thing/ --seed 42]
287
+ end
288
+
289
+ def assert_filtering filter, name, expected, a = false
290
+ args = %W[--#{filter} #{name} --seed 42]
291
+
292
+ alpha = Class.new Minitest::Test do
293
+ define_method :test_something do
294
+ assert a
295
+ end
296
+ end
297
+ Object.const_set(:Alpha, alpha)
298
+
299
+ beta = Class.new Minitest::Test do
300
+ define_method :test_something do
301
+ assert true
302
+ end
303
+ end
304
+ Object.const_set(:Beta, beta)
305
+
306
+ @tus = [alpha, beta]
307
+
308
+ assert_report expected, args
309
+ ensure
310
+ Object.send :remove_const, :Alpha
311
+ Object.send :remove_const, :Beta
312
+ end
313
+
314
+ def test_run_filtered_including_suite_name
315
+ expected = clean <<-EOM
316
+ .
317
+
318
+ Finished in 0.00
319
+
320
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
321
+ EOM
322
+
323
+ assert_filtering 'name', "/Beta#test_something/", expected
324
+ end
325
+
326
+ def test_run_filtered_including_suite_name_string
327
+ expected = clean <<-EOM
328
+ .
329
+
330
+ Finished in 0.00
331
+
332
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
333
+ EOM
334
+
335
+ assert_filtering 'name', "Beta#test_something", expected
336
+ end
337
+
338
+ def test_run_filtered_string_method_only
339
+ expected = clean <<-EOM
340
+ ..
341
+
342
+ Finished in 0.00
343
+
344
+ 2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
345
+ EOM
346
+
347
+ assert_filtering 'name', "test_something", expected, :pass
348
+ end
349
+
350
+ def test_run_failing_excluded
351
+ setup_basic_tu
352
+
353
+ expected = clean <<-EOM
354
+ .
355
+
356
+ Finished in 0.00
357
+
358
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
359
+ EOM
360
+
361
+ assert_report expected, %w[--exclude /failure/ --seed 42]
362
+ end
363
+
364
+ def test_run_filtered_excluding_suite_name
365
+ expected = clean <<-EOM
366
+ .
367
+
368
+ Finished in 0.00
369
+
370
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
371
+ EOM
372
+
373
+ assert_filtering 'exclude', "/Alpha#test_something/", expected
374
+ end
375
+
376
+ def test_run_filtered_excluding_suite_name_string
377
+ expected = clean <<-EOM
378
+ .
379
+
380
+ Finished in 0.00
381
+
382
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
383
+ EOM
384
+
385
+ assert_filtering 'exclude', "Alpha#test_something", expected
386
+ end
387
+
388
+ def test_run_filtered_excluding_string_method_only
389
+ expected = clean <<-EOM
390
+
391
+
392
+ Finished in 0.00
393
+
394
+ 0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
395
+ EOM
396
+
397
+ assert_filtering 'exclude', "test_something", expected, :pass
398
+ end
399
+
400
+ def test_run_passing
401
+ @tu =
402
+ Class.new Minitest::Test do
403
+ def test_something
404
+ assert true
405
+ end
406
+ end
407
+
408
+ expected = clean <<-EOM
409
+ .
410
+
411
+ Finished in 0.00
412
+
413
+ 1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
414
+ EOM
415
+
416
+ assert_report expected
417
+ end
418
+
419
+ def test_run_skip
420
+ @tu =
421
+ Class.new Minitest::Test do
422
+ def test_something
423
+ assert true
424
+ end
425
+
426
+ def test_skip
427
+ skip "not yet"
428
+ end
429
+ end
430
+
431
+ expected = clean <<-EOM
432
+ S.
433
+
434
+ Finished in 0.00
435
+
436
+ 2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
437
+
438
+ You have skipped tests. Run with --verbose for details.
439
+ EOM
440
+
441
+ restore_env do
442
+ assert_report expected
443
+ end
444
+ end
445
+
446
+ def test_run_skip_verbose
447
+ @tu =
448
+ Class.new Minitest::Test do
449
+ def test_something
450
+ assert true
451
+ end
452
+
453
+ def test_skip
454
+ skip "not yet"
455
+ end
456
+ end
457
+
458
+ expected = clean <<-EOM
459
+ #<Class:0xXXX>#test_skip = 0.00 s = S
460
+ #<Class:0xXXX>#test_something = 0.00 s = .
461
+
462
+ Finished in 0.00
463
+
464
+ 1) Skipped:
465
+ #<Class:0xXXX>#test_skip [FILE:LINE]:
466
+ not yet
467
+
468
+ 2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
469
+ EOM
470
+
471
+ assert_report expected, %w[--seed 42 --verbose]
472
+ end
473
+
474
+ def test_run_with_other_runner
475
+ @tu =
476
+ Class.new Minitest::Test do
477
+ def self.run reporter, options = {}
478
+ @reporter = reporter
479
+ before_my_suite
480
+ super
481
+ end
482
+
483
+ def self.name; "wacky!" end
484
+
485
+ def self.before_my_suite
486
+ @reporter.io.puts "Running #{self.name} tests"
487
+ @@foo = 1
488
+ end
489
+
490
+ def test_something
491
+ assert_equal 1, @@foo
492
+ end
493
+
494
+ def test_something_else
495
+ assert_equal 1, @@foo
496
+ end
497
+ end
498
+
499
+ expected = clean <<-EOM
500
+ Running wacky! tests
501
+ ..
502
+
503
+ Finished in 0.00
504
+
505
+ 2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
506
+ EOM
507
+
508
+ assert_report expected
509
+ end
510
+
511
+ require "monitor"
512
+
513
+ class Latch
514
+ def initialize count = 1
515
+ @count = count
516
+ @lock = Monitor.new
517
+ @cv = @lock.new_cond
518
+ end
519
+
520
+ def release
521
+ @lock.synchronize do
522
+ @count -= 1 if @count > 0
523
+ @cv.broadcast if @count == 0
524
+ end
525
+ end
526
+
527
+ def await
528
+ @lock.synchronize { @cv.wait_while { @count > 0 } }
529
+ end
530
+ end
531
+
532
+ def test_run_parallel
533
+ skip "I don't have ParallelEach debugged yet" if maglev?
534
+
535
+ test_count = 2
536
+ test_latch = Latch.new test_count
537
+ wait_latch = Latch.new test_count
538
+ main_latch = Latch.new
539
+
540
+ thread = Thread.new {
541
+ Thread.current.abort_on_exception = true
542
+
543
+ # This latch waits until both test latches have been released. Both
544
+ # latches can't be released unless done in separate threads because
545
+ # `main_latch` keeps the test method from finishing.
546
+ test_latch.await
547
+ main_latch.release
548
+ }
549
+
550
+ @tu =
551
+ Class.new Minitest::Test do
552
+ parallelize_me!
553
+
554
+ test_count.times do |i|
555
+ define_method :"test_wait_on_main_thread_#{i}" do
556
+ test_latch.release
557
+
558
+ # This latch blocks until the "main thread" releases it. The main
559
+ # thread can't release this latch until both test latches have
560
+ # been released. This forces the latches to be released in separate
561
+ # threads.
562
+ main_latch.await
563
+ assert true
564
+ end
565
+ end
566
+ end
567
+
568
+ expected = clean <<-EOM
569
+ ..
570
+
571
+ Finished in 0.00
572
+
573
+ 2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
574
+ EOM
575
+
576
+ assert_report(expected) do |reporter|
577
+ reporter.extend(Module.new {
578
+ define_method("record") do |result|
579
+ super(result)
580
+ wait_latch.release
581
+ end
582
+
583
+ define_method("report") do
584
+ wait_latch.await
585
+ super()
586
+ end
587
+ })
588
+ end
589
+ assert thread.join
590
+ end
591
+ end
592
+
593
+ class TestMinitestUnitOrder < MetaMetaMetaTestCase
594
+ # do not parallelize this suite... it just can't handle it.
595
+
596
+ def test_before_setup
597
+ call_order = []
598
+ @tu =
599
+ Class.new Minitest::Test do
600
+ define_method :setup do
601
+ super()
602
+ call_order << :setup
603
+ end
604
+
605
+ define_method :before_setup do
606
+ call_order << :before_setup
607
+ end
608
+
609
+ def test_omg; assert true; end
610
+ end
611
+
612
+ run_tu_with_fresh_reporter
613
+
614
+ expected = [:before_setup, :setup]
615
+ assert_equal expected, call_order
616
+ end
617
+
618
+ def test_after_teardown
619
+ call_order = []
620
+ @tu =
621
+ Class.new Minitest::Test do
622
+ define_method :teardown do
623
+ super()
624
+ call_order << :teardown
625
+ end
626
+
627
+ define_method :after_teardown do
628
+ call_order << :after_teardown
629
+ end
630
+
631
+ def test_omg; assert true; end
632
+ end
633
+
634
+ run_tu_with_fresh_reporter
635
+
636
+ expected = [:teardown, :after_teardown]
637
+ assert_equal expected, call_order
638
+ end
639
+
640
+ def test_all_teardowns_are_guaranteed_to_run
641
+ call_order = []
642
+ @tu =
643
+ Class.new Minitest::Test do
644
+ define_method :after_teardown do
645
+ super()
646
+ call_order << :after_teardown
647
+ raise
648
+ end
649
+
650
+ define_method :teardown do
651
+ super()
652
+ call_order << :teardown
653
+ raise
654
+ end
655
+
656
+ define_method :before_teardown do
657
+ super()
658
+ call_order << :before_teardown
659
+ raise
660
+ end
661
+
662
+ def test_omg; assert true; end
663
+ end
664
+
665
+ run_tu_with_fresh_reporter
666
+
667
+ expected = [:before_teardown, :teardown, :after_teardown]
668
+ assert_equal expected, call_order
669
+ end
670
+
671
+ def test_setup_and_teardown_survive_inheritance
672
+ call_order = []
673
+
674
+ @tu = Class.new Minitest::Test do
675
+ define_method :setup do
676
+ call_order << :setup_method
677
+ end
678
+
679
+ define_method :teardown do
680
+ call_order << :teardown_method
681
+ end
682
+
683
+ define_method :test_something do
684
+ call_order << :test
685
+ end
686
+ end
687
+
688
+ run_tu_with_fresh_reporter
689
+
690
+ @tu = Class.new @tu
691
+ run_tu_with_fresh_reporter
692
+
693
+ # Once for the parent class, once for the child
694
+ expected = [:setup_method, :test, :teardown_method] * 2
695
+
696
+ assert_equal expected, call_order
697
+ end
698
+ end
699
+
700
+ class TestMinitestRunnable < Minitest::Test
701
+ def setup_marshal klass
702
+ tc = klass.new "whatever"
703
+ tc.assertions = 42
704
+ tc.failures << "a failure"
705
+
706
+ yield tc if block_given?
707
+
708
+ def tc.setup
709
+ @blah = "blah"
710
+ end
711
+ tc.setup
712
+
713
+ @tc = tc
714
+ end
715
+
716
+ def assert_marshal expected_ivars
717
+ new_tc = Marshal.load Marshal.dump @tc
718
+
719
+ ivars = new_tc.instance_variables.map(&:to_s).sort
720
+ assert_equal expected_ivars, ivars
721
+ assert_equal "whatever", new_tc.name
722
+ assert_equal 42, new_tc.assertions
723
+ assert_equal ["a failure"], new_tc.failures
724
+
725
+ yield new_tc if block_given?
726
+ end
727
+
728
+ def test_marshal
729
+ setup_marshal Minitest::Runnable
730
+
731
+ assert_marshal %w[@NAME @assertions @failures]
732
+ end
733
+ end
734
+
735
+ class TestMinitestTest < TestMinitestRunnable
736
+ def test_dup
737
+ setup_marshal Minitest::Test do |tc|
738
+ tc.time = 3.14
739
+ end
740
+
741
+ assert_marshal %w[@NAME @assertions @failures @time] do |new_tc|
742
+ assert_in_epsilon 3.14, new_tc.time
743
+ end
744
+ end
745
+ end
746
+
747
+ class TestMinitestUnitTestCase < Minitest::Test
748
+ # do not call parallelize_me! - teardown accesses @tc._assertions
749
+ # which is not threadsafe. Nearly every method in here is an
750
+ # assertion test so it isn't worth splitting it out further.
751
+
752
+ RUBY18 = !defined? Encoding
753
+
754
+ def setup
755
+ super
756
+
757
+ Minitest::Test.reset
758
+
759
+ @tc = Minitest::Test.new "fake tc"
760
+ @zomg = "zomg ponies!"
761
+ @assertion_count = 1
762
+ end
763
+
764
+ def teardown
765
+ assert_equal(@assertion_count, @tc.assertions,
766
+ "expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed?
767
+ end
768
+
769
+ def non_verbose
770
+ orig_verbose = $VERBOSE
771
+ $VERBOSE = false
772
+
773
+ yield
774
+ ensure
775
+ $VERBOSE = orig_verbose
776
+ end
777
+
778
+ def test_assert
779
+ @assertion_count = 2
780
+
781
+ @tc.assert_equal true, @tc.assert(true), "returns true on success"
782
+ end
783
+
784
+ def test_assert__triggered
785
+ assert_triggered "Expected false to be truthy." do
786
+ @tc.assert false
787
+ end
788
+ end
789
+
790
+ def test_assert__triggered_message
791
+ assert_triggered @zomg do
792
+ @tc.assert false, @zomg
793
+ end
794
+ end
795
+
796
+ def test_assert_empty
797
+ @assertion_count = 2
798
+
799
+ @tc.assert_empty []
800
+ end
801
+
802
+ def test_assert_empty_triggered
803
+ @assertion_count = 2
804
+
805
+ assert_triggered "Expected [1] to be empty." do
806
+ @tc.assert_empty [1]
807
+ end
808
+ end
809
+
810
+ def test_assert_equal
811
+ @tc.assert_equal 1, 1
812
+ end
813
+
814
+ def test_assert_equal_different_collection_array_hex_invisible
815
+ object1 = Object.new
816
+ object2 = Object.new
817
+ msg = "No visible difference in the Array#inspect output.
818
+ You should look at the implementation of #== on Array or its members.
819
+ [#<Object:0xXXXXXX>]".gsub(/^ +/, "")
820
+ assert_triggered msg do
821
+ @tc.assert_equal [object1], [object2]
822
+ end
823
+ end
824
+
825
+ def test_assert_equal_different_collection_hash_hex_invisible
826
+ h1, h2 = {}, {}
827
+ h1[1] = Object.new
828
+ h2[1] = Object.new
829
+ msg = "No visible difference in the Hash#inspect output.
830
+ You should look at the implementation of #== on Hash or its members.
831
+ {1=>#<Object:0xXXXXXX>}".gsub(/^ +/, "")
832
+
833
+ assert_triggered msg do
834
+ @tc.assert_equal h1, h2
835
+ end
836
+ end
837
+
838
+ def test_assert_equal_string_encodings
839
+ msg = <<-EOM.gsub(/^ {10}/, "")
840
+ --- expected
841
+ +++ actual
842
+ @@ -1 +1,2 @@
843
+ +# encoding: ASCII-8BIT
844
+ "bad-utf8-\\xF1.txt"
845
+ EOM
846
+
847
+ assert_triggered msg do
848
+ x = "bad-utf8-\xF1.txt"
849
+ y = x.dup.force_encoding "binary" # TODO: switch to .b when 1.9 dropped
850
+ @tc.assert_equal x, y
851
+ end
852
+ end unless RUBY18
853
+
854
+ def test_assert_equal_string_encodings_both_different
855
+ msg = <<-EOM.gsub(/^ {10}/, "")
856
+ --- expected
857
+ +++ actual
858
+ @@ -1,2 +1,2 @@
859
+ -# encoding: US-ASCII
860
+ +# encoding: ASCII-8BIT
861
+ "bad-utf8-\\xF1.txt"
862
+ EOM
863
+
864
+ assert_triggered msg do
865
+ x = "bad-utf8-\xF1.txt".force_encoding "ASCII"
866
+ y = x.dup.force_encoding "binary" # TODO: switch to .b when 1.9 dropped
867
+ @tc.assert_equal x, y
868
+ end
869
+ end unless RUBY18
870
+
871
+ def test_assert_equal_different_diff_deactivated
872
+ skip "https://github.com/MagLev/maglev/issues/209" if maglev?
873
+
874
+ without_diff do
875
+ assert_triggered util_msg("haha" * 10, "blah" * 10) do
876
+ o1 = "haha" * 10
877
+ o2 = "blah" * 10
878
+
879
+ @tc.assert_equal o1, o2
880
+ end
881
+ end
882
+ end
883
+
884
+ def test_assert_equal_different_hex
885
+ c = Class.new do
886
+ def initialize s; @name = s; end
887
+ end
888
+
889
+ o1 = c.new "a"
890
+ o2 = c.new "b"
891
+ msg = "--- expected
892
+ +++ actual
893
+ @@ -1 +1 @@
894
+ -#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">
895
+ +#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">
896
+ ".gsub(/^ +/, "")
897
+
898
+ assert_triggered msg do
899
+ @tc.assert_equal o1, o2
900
+ end
901
+ end
902
+
903
+ def test_assert_equal_different_hex_invisible
904
+ o1 = Object.new
905
+ o2 = Object.new
906
+
907
+ msg = "No visible difference in the Object#inspect output.
908
+ You should look at the implementation of #== on Object or its members.
909
+ #<Object:0xXXXXXX>".gsub(/^ +/, "")
910
+
911
+ assert_triggered msg do
912
+ @tc.assert_equal o1, o2
913
+ end
914
+ end
915
+
916
+ def test_assert_equal_different_long
917
+ msg = "--- expected
918
+ +++ actual
919
+ @@ -1 +1 @@
920
+ -\"hahahahahahahahahahahahahahahahahahahaha\"
921
+ +\"blahblahblahblahblahblahblahblahblahblah\"
922
+ ".gsub(/^ +/, "")
923
+
924
+ assert_triggered msg do
925
+ o1 = "haha" * 10
926
+ o2 = "blah" * 10
927
+
928
+ @tc.assert_equal o1, o2
929
+ end
930
+ end
931
+
932
+ def test_assert_equal_different_long_invisible
933
+ msg = "No visible difference in the String#inspect output.
934
+ You should look at the implementation of #== on String or its members.
935
+ \"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
936
+
937
+ assert_triggered msg do
938
+ o1 = "blah" * 10
939
+ o2 = "blah" * 10
940
+ def o1.== _
941
+ false
942
+ end
943
+ @tc.assert_equal o1, o2
944
+ end
945
+ end
946
+
947
+ def test_assert_equal_different_long_msg
948
+ msg = "message.
949
+ --- expected
950
+ +++ actual
951
+ @@ -1 +1 @@
952
+ -\"hahahahahahahahahahahahahahahahahahahaha\"
953
+ +\"blahblahblahblahblahblahblahblahblahblah\"
954
+ ".gsub(/^ +/, "")
955
+
956
+ assert_triggered msg do
957
+ o1 = "haha" * 10
958
+ o2 = "blah" * 10
959
+ @tc.assert_equal o1, o2, "message"
960
+ end
961
+ end
962
+
963
+ def test_assert_equal_different_short
964
+ assert_triggered util_msg(1, 2) do
965
+ @tc.assert_equal 1, 2
966
+ end
967
+ end
968
+
969
+ def test_assert_equal_different_short_msg
970
+ assert_triggered util_msg(1, 2, "message") do
971
+ @tc.assert_equal 1, 2, "message"
972
+ end
973
+ end
974
+
975
+ def test_assert_equal_different_short_multiline
976
+ msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n"
977
+ assert_triggered msg do
978
+ @tc.assert_equal "a\nb", "a\nc"
979
+ end
980
+ end
981
+
982
+ def test_assert_in_delta
983
+ @tc.assert_in_delta 0.0, 1.0 / 1000, 0.1
984
+ end
985
+
986
+ def test_delta_consistency
987
+ @assertion_count = 2
988
+
989
+ @tc.assert_in_delta 0, 1, 1
990
+
991
+ assert_triggered "Expected |0 - 1| (1) to not be <= 1." do
992
+ @tc.refute_in_delta 0, 1, 1
993
+ end
994
+ end
995
+
996
+ def test_assert_in_delta_triggered
997
+ x = maglev? ? "9.999999xxxe-07" : "1.0e-06"
998
+ assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
999
+ @tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
1000
+ end
1001
+ end
1002
+
1003
+ def test_assert_in_epsilon
1004
+ @assertion_count = 10
1005
+
1006
+ @tc.assert_in_epsilon 10_000, 9991
1007
+ @tc.assert_in_epsilon 9991, 10_000
1008
+ @tc.assert_in_epsilon 1.0, 1.001
1009
+ @tc.assert_in_epsilon 1.001, 1.0
1010
+
1011
+ @tc.assert_in_epsilon 10_000, 9999.1, 0.0001
1012
+ @tc.assert_in_epsilon 9999.1, 10_000, 0.0001
1013
+ @tc.assert_in_epsilon 1.0, 1.0001, 0.0001
1014
+ @tc.assert_in_epsilon 1.0001, 1.0, 0.0001
1015
+
1016
+ @tc.assert_in_epsilon(-1, -1)
1017
+ @tc.assert_in_epsilon(-10_000, -9991)
1018
+ end
1019
+
1020
+ def test_epsilon_consistency
1021
+ @assertion_count = 2
1022
+
1023
+ @tc.assert_in_epsilon 1.0, 1.001
1024
+
1025
+ msg = "Expected |1.0 - 1.001| (0.000999xxx) to not be <= 0.001."
1026
+ assert_triggered msg do
1027
+ @tc.refute_in_epsilon 1.0, 1.001
1028
+ end
1029
+ end
1030
+
1031
+ def test_assert_in_epsilon_triggered
1032
+ assert_triggered "Expected |10000 - 9990| (10) to be <= 9.99." do
1033
+ @tc.assert_in_epsilon 10_000, 9990
1034
+ end
1035
+ end
1036
+
1037
+ def test_assert_in_epsilon_triggered_negative_case
1038
+ x = (RUBY18 and not maglev?) ? "0.1" : "0.100000xxx"
1039
+ y = maglev? ? "0.100000xxx" : "0.1"
1040
+ assert_triggered "Expected |-1.1 - -1| (#{x}) to be <= #{y}." do
1041
+ @tc.assert_in_epsilon(-1.1, -1, 0.1)
1042
+ end
1043
+ end
1044
+
1045
+ def test_assert_includes
1046
+ @assertion_count = 2
1047
+
1048
+ @tc.assert_includes [true], true
1049
+ end
1050
+
1051
+ def test_assert_includes_triggered
1052
+ @assertion_count = 3
1053
+
1054
+ e = @tc.assert_raises Minitest::Assertion do
1055
+ @tc.assert_includes [true], false
1056
+ end
1057
+
1058
+ expected = "Expected [true] to include false."
1059
+ assert_equal expected, e.message
1060
+ end
1061
+
1062
+ def test_assert_instance_of
1063
+ @tc.assert_instance_of String, "blah"
1064
+ end
1065
+
1066
+ def test_assert_instance_of_triggered
1067
+ assert_triggered 'Expected "blah" to be an instance of Array, not String.' do
1068
+ @tc.assert_instance_of Array, "blah"
1069
+ end
1070
+ end
1071
+
1072
+ def test_assert_kind_of
1073
+ @tc.assert_kind_of String, "blah"
1074
+ end
1075
+
1076
+ def test_assert_kind_of_triggered
1077
+ assert_triggered 'Expected "blah" to be a kind of Array, not String.' do
1078
+ @tc.assert_kind_of Array, "blah"
1079
+ end
1080
+ end
1081
+
1082
+ def test_assert_match
1083
+ @assertion_count = 2
1084
+ @tc.assert_match(/\w+/, "blah blah blah")
1085
+ end
1086
+
1087
+ def test_assert_match_matcher_object
1088
+ @assertion_count = 2
1089
+
1090
+ pattern = Object.new
1091
+ def pattern.=~(_) true end
1092
+
1093
+ @tc.assert_match pattern, 5
1094
+ end
1095
+
1096
+ def test_assert_match_matchee_to_str
1097
+ @assertion_count = 2
1098
+
1099
+ obj = Object.new
1100
+ def obj.to_str; "blah" end
1101
+
1102
+ @tc.assert_match "blah", obj
1103
+ end
1104
+
1105
+ def test_assert_match_object_triggered
1106
+ @assertion_count = 2
1107
+
1108
+ pattern = Object.new
1109
+ def pattern.=~(_) false end
1110
+ def pattern.inspect; "[Object]" end
1111
+
1112
+ assert_triggered "Expected [Object] to match 5." do
1113
+ @tc.assert_match pattern, 5
1114
+ end
1115
+ end
1116
+
1117
+ def test_assert_match_triggered
1118
+ @assertion_count = 2
1119
+ assert_triggered 'Expected /\d+/ to match "blah blah blah".' do
1120
+ @tc.assert_match(/\d+/, "blah blah blah")
1121
+ end
1122
+ end
1123
+
1124
+ def test_assert_nil
1125
+ @tc.assert_nil nil
1126
+ end
1127
+
1128
+ def test_assert_nil_triggered
1129
+ assert_triggered "Expected 42 to be nil." do
1130
+ @tc.assert_nil 42
1131
+ end
1132
+ end
1133
+
1134
+ def test_assert_operator
1135
+ @tc.assert_operator 2, :>, 1
1136
+ end
1137
+
1138
+ def test_assert_operator_bad_object
1139
+ bad = Object.new
1140
+ def bad.==(_) true end
1141
+
1142
+ @tc.assert_operator bad, :equal?, bad
1143
+ end
1144
+
1145
+ def test_assert_operator_triggered
1146
+ assert_triggered "Expected 2 to be < 1." do
1147
+ @tc.assert_operator 2, :<, 1
1148
+ end
1149
+ end
1150
+
1151
+ def test_assert_output_both
1152
+ @assertion_count = 2
1153
+
1154
+ @tc.assert_output "yay", "blah" do
1155
+ print "yay"
1156
+ $stderr.print "blah"
1157
+ end
1158
+ end
1159
+
1160
+ def test_assert_output_both_regexps
1161
+ @assertion_count = 4
1162
+
1163
+ @tc.assert_output(/y.y/, /bl.h/) do
1164
+ print "yay"
1165
+ $stderr.print "blah"
1166
+ end
1167
+ end
1168
+
1169
+ def test_assert_output_err
1170
+ @tc.assert_output nil, "blah" do
1171
+ $stderr.print "blah"
1172
+ end
1173
+ end
1174
+
1175
+ def test_assert_output_neither
1176
+ @assertion_count = 0
1177
+
1178
+ @tc.assert_output do
1179
+ # do nothing
1180
+ end
1181
+ end
1182
+
1183
+ def test_assert_output_out
1184
+ @tc.assert_output "blah" do
1185
+ print "blah"
1186
+ end
1187
+ end
1188
+
1189
+ def test_assert_output_triggered_both
1190
+ assert_triggered util_msg("blah", "blah blah", "In stderr") do
1191
+ @tc.assert_output "yay", "blah" do
1192
+ print "boo"
1193
+ $stderr.print "blah blah"
1194
+ end
1195
+ end
1196
+ end
1197
+
1198
+ def test_assert_output_triggered_err
1199
+ assert_triggered util_msg("blah", "blah blah", "In stderr") do
1200
+ @tc.assert_output nil, "blah" do
1201
+ $stderr.print "blah blah"
1202
+ end
1203
+ end
1204
+ end
1205
+
1206
+ def test_assert_output_triggered_out
1207
+ assert_triggered util_msg("blah", "blah blah", "In stdout") do
1208
+ @tc.assert_output "blah" do
1209
+ print "blah blah"
1210
+ end
1211
+ end
1212
+ end
1213
+
1214
+ def test_assert_predicate
1215
+ @tc.assert_predicate "", :empty?
1216
+ end
1217
+
1218
+ def test_assert_predicate_triggered
1219
+ assert_triggered 'Expected "blah" to be empty?.' do
1220
+ @tc.assert_predicate "blah", :empty?
1221
+ end
1222
+ end
1223
+
1224
+ def test_assert_raises
1225
+ @tc.assert_raises RuntimeError do
1226
+ raise "blah"
1227
+ end
1228
+ end
1229
+
1230
+ def test_assert_raises_default
1231
+ @tc.assert_raises do
1232
+ raise StandardError, "blah"
1233
+ end
1234
+ end
1235
+
1236
+ def test_assert_raises_default_triggered
1237
+ e = assert_raises Minitest::Assertion do
1238
+ @tc.assert_raises do
1239
+ raise SomeError, "blah"
1240
+ end
1241
+ end
1242
+
1243
+ expected = clean <<-EOM.chomp
1244
+ [StandardError] exception expected, not
1245
+ Class: <SomeError>
1246
+ Message: <\"blah\">
1247
+ ---Backtrace---
1248
+ FILE:LINE:in \`test_assert_raises_default_triggered\'
1249
+ ---------------
1250
+ EOM
1251
+
1252
+ actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
1253
+ actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"
1254
+
1255
+ assert_equal expected, actual
1256
+ end
1257
+
1258
+ def test_assert_raises_module
1259
+ @tc.assert_raises MyModule do
1260
+ raise AnError
1261
+ end
1262
+ end
1263
+
1264
+ ##
1265
+ # *sigh* This is quite an odd scenario, but it is from real (albeit
1266
+ # ugly) test code in ruby-core:
1267
+ #
1268
+ # http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29259
1269
+
1270
+ def test_assert_raises_skip
1271
+ @assertion_count = 0
1272
+
1273
+ assert_triggered "skipped", Minitest::Skip do
1274
+ @tc.assert_raises ArgumentError do
1275
+ begin
1276
+ raise "blah"
1277
+ rescue
1278
+ skip "skipped"
1279
+ end
1280
+ end
1281
+ end
1282
+ end
1283
+
1284
+ def test_assert_raises_triggered_different
1285
+ e = assert_raises Minitest::Assertion do
1286
+ @tc.assert_raises RuntimeError do
1287
+ raise SyntaxError, "icky"
1288
+ end
1289
+ end
1290
+
1291
+ expected = clean <<-EOM.chomp
1292
+ [RuntimeError] exception expected, not
1293
+ Class: <SyntaxError>
1294
+ Message: <\"icky\">
1295
+ ---Backtrace---
1296
+ FILE:LINE:in \`test_assert_raises_triggered_different\'
1297
+ ---------------
1298
+ EOM
1299
+
1300
+ actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
1301
+ actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"
1302
+
1303
+ assert_equal expected, actual
1304
+ end
1305
+
1306
+ def test_assert_raises_triggered_different_msg
1307
+ e = assert_raises Minitest::Assertion do
1308
+ @tc.assert_raises RuntimeError, "XXX" do
1309
+ raise SyntaxError, "icky"
1310
+ end
1311
+ end
1312
+
1313
+ expected = clean <<-EOM
1314
+ XXX.
1315
+ [RuntimeError] exception expected, not
1316
+ Class: <SyntaxError>
1317
+ Message: <\"icky\">
1318
+ ---Backtrace---
1319
+ FILE:LINE:in \`test_assert_raises_triggered_different_msg\'
1320
+ ---------------
1321
+ EOM
1322
+
1323
+ actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
1324
+ actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"
1325
+
1326
+ assert_equal expected.chomp, actual
1327
+ end
1328
+
1329
+ def test_assert_raises_triggered_none
1330
+ e = assert_raises Minitest::Assertion do
1331
+ @tc.assert_raises Minitest::Assertion do
1332
+ # do nothing
1333
+ end
1334
+ end
1335
+
1336
+ expected = "Minitest::Assertion expected but nothing was raised."
1337
+
1338
+ assert_equal expected, e.message
1339
+ end
1340
+
1341
+ def test_assert_raises_triggered_none_msg
1342
+ e = assert_raises Minitest::Assertion do
1343
+ @tc.assert_raises Minitest::Assertion, "XXX" do
1344
+ # do nothing
1345
+ end
1346
+ end
1347
+
1348
+ expected = "XXX.\nMinitest::Assertion expected but nothing was raised."
1349
+
1350
+ assert_equal expected, e.message
1351
+ end
1352
+
1353
+ def test_assert_raises_subclass
1354
+ @tc.assert_raises StandardError do
1355
+ raise AnError
1356
+ end
1357
+ end
1358
+
1359
+ def test_assert_raises_subclass_triggered
1360
+ e = assert_raises Minitest::Assertion do
1361
+ @tc.assert_raises SomeError do
1362
+ raise AnError, "some message"
1363
+ end
1364
+ end
1365
+
1366
+ expected = clean <<-EOM
1367
+ [SomeError] exception expected, not
1368
+ Class: <AnError>
1369
+ Message: <\"some message\">
1370
+ ---Backtrace---
1371
+ FILE:LINE:in \`test_assert_raises_subclass_triggered\'
1372
+ ---------------
1373
+ EOM
1374
+
1375
+ actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
1376
+ actual.gsub!(/block \(\d+ levels\) in /, "") if RUBY_VERSION >= "1.9.0"
1377
+
1378
+ assert_equal expected.chomp, actual
1379
+ end
1380
+
1381
+ def test_assert_raises_exit
1382
+ @tc.assert_raises SystemExit do
1383
+ exit 1
1384
+ end
1385
+ end
1386
+
1387
+ def test_assert_raises_signals
1388
+ @tc.assert_raises SignalException do
1389
+ raise SignalException, :INT
1390
+ end
1391
+ end
1392
+
1393
+ def test_assert_respond_to
1394
+ @tc.assert_respond_to "blah", :empty?
1395
+ end
1396
+
1397
+ def test_assert_respond_to_triggered
1398
+ assert_triggered 'Expected "blah" (String) to respond to #rawr!.' do
1399
+ @tc.assert_respond_to "blah", :rawr!
1400
+ end
1401
+ end
1402
+
1403
+ def test_assert_same
1404
+ @assertion_count = 3
1405
+
1406
+ o = "blah"
1407
+ @tc.assert_same 1, 1
1408
+ @tc.assert_same :blah, :blah
1409
+ @tc.assert_same o, o
1410
+ end
1411
+
1412
+ def test_assert_same_triggered
1413
+ @assertion_count = 2
1414
+
1415
+ assert_triggered "Expected 2 (oid=N) to be the same as 1 (oid=N)." do
1416
+ @tc.assert_same 1, 2
1417
+ end
1418
+
1419
+ s1 = "blah"
1420
+ s2 = "blah"
1421
+
1422
+ assert_triggered 'Expected "blah" (oid=N) to be the same as "blah" (oid=N).' do
1423
+ @tc.assert_same s1, s2
1424
+ end
1425
+ end
1426
+
1427
+ def test_assert_send
1428
+ @tc.assert_send [1, :<, 2]
1429
+ end
1430
+
1431
+ def test_assert_send_bad
1432
+ assert_triggered "Expected 1.>(*[2]) to return true." do
1433
+ @tc.assert_send [1, :>, 2]
1434
+ end
1435
+ end
1436
+
1437
+ def test_assert_silent
1438
+ @assertion_count = 2
1439
+
1440
+ @tc.assert_silent do
1441
+ # do nothing
1442
+ end
1443
+ end
1444
+
1445
+ def test_assert_silent_triggered_err
1446
+ assert_triggered util_msg("", "blah blah", "In stderr") do
1447
+ @tc.assert_silent do
1448
+ $stderr.print "blah blah"
1449
+ end
1450
+ end
1451
+ end
1452
+
1453
+ def test_assert_silent_triggered_out
1454
+ @assertion_count = 2
1455
+
1456
+ assert_triggered util_msg("", "blah blah", "In stdout") do
1457
+ @tc.assert_silent do
1458
+ print "blah blah"
1459
+ end
1460
+ end
1461
+ end
1462
+
1463
+ def test_assert_throws
1464
+ @tc.assert_throws :blah do
1465
+ throw :blah
1466
+ end
1467
+ end
1468
+
1469
+ def test_assert_throws_different
1470
+ assert_triggered "Expected :blah to have been thrown, not :not_blah." do
1471
+ @tc.assert_throws :blah do
1472
+ throw :not_blah
1473
+ end
1474
+ end
1475
+ end
1476
+
1477
+ def test_assert_throws_unthrown
1478
+ assert_triggered "Expected :blah to have been thrown." do
1479
+ @tc.assert_throws :blah do
1480
+ # do nothing
1481
+ end
1482
+ end
1483
+ end
1484
+
1485
+ def test_capture_io
1486
+ @assertion_count = 0
1487
+
1488
+ non_verbose do
1489
+ out, err = capture_io do
1490
+ puts "hi"
1491
+ $stderr.puts "bye!"
1492
+ end
1493
+
1494
+ assert_equal "hi\n", out
1495
+ assert_equal "bye!\n", err
1496
+ end
1497
+ end
1498
+
1499
+ def test_capture_subprocess_io
1500
+ @assertion_count = 0
1501
+
1502
+ non_verbose do
1503
+ out, err = capture_subprocess_io do
1504
+ system("echo hi")
1505
+ system("echo bye! 1>&2")
1506
+ end
1507
+
1508
+ assert_equal "hi\n", out
1509
+ assert_equal "bye!", err.strip
1510
+ end
1511
+ end
1512
+
1513
+ def test_class_asserts_match_refutes
1514
+ @assertion_count = 0
1515
+
1516
+ methods = Minitest::Assertions.public_instance_methods
1517
+ methods.map!(&:to_s) if Symbol === methods.first
1518
+
1519
+ # These don't have corresponding refutes _on purpose_. They're
1520
+ # useless and will never be added, so don't bother.
1521
+ ignores = %w[assert_output assert_raises assert_send
1522
+ assert_silent assert_throws assert_mock]
1523
+
1524
+ # These are test/unit methods. I'm not actually sure why they're still here
1525
+ ignores += %w[assert_no_match assert_not_equal assert_not_nil
1526
+ assert_not_same assert_nothing_raised
1527
+ assert_nothing_thrown assert_raise]
1528
+
1529
+ asserts = methods.grep(/^assert/).sort - ignores
1530
+ refutes = methods.grep(/^refute/).sort - ignores
1531
+
1532
+ assert_empty refutes.map { |n| n.sub(/^refute/, "assert") } - asserts
1533
+ assert_empty asserts.map { |n| n.sub(/^assert/, "refute") } - refutes
1534
+ end
1535
+
1536
+ def test_flunk
1537
+ assert_triggered "Epic Fail!" do
1538
+ @tc.flunk
1539
+ end
1540
+ end
1541
+
1542
+ def test_flunk_message
1543
+ assert_triggered @zomg do
1544
+ @tc.flunk @zomg
1545
+ end
1546
+ end
1547
+
1548
+ def test_message
1549
+ @assertion_count = 0
1550
+
1551
+ assert_equal "blah2.", @tc.message { "blah2" }.call
1552
+ assert_equal "blah2.", @tc.message("") { "blah2" }.call
1553
+ assert_equal "blah1.\nblah2.", @tc.message(:blah1) { "blah2" }.call
1554
+ assert_equal "blah1.\nblah2.", @tc.message("blah1") { "blah2" }.call
1555
+
1556
+ message = proc { "blah1" }
1557
+ assert_equal "blah1.\nblah2.", @tc.message(message) { "blah2" }.call
1558
+
1559
+ message = @tc.message { "blah1" }
1560
+ assert_equal "blah1.\nblah2.", @tc.message(message) { "blah2" }.call
1561
+ end
1562
+
1563
+ def test_message_message
1564
+ assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
1565
+ @tc.assert_equal 1, 2, message { "whoops" }
1566
+ end
1567
+ end
1568
+
1569
+ def test_message_lambda
1570
+ assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
1571
+ @tc.assert_equal 1, 2, lambda { "whoops" }
1572
+ end
1573
+ end
1574
+
1575
+ def test_message_deferred
1576
+ @assertion_count, var = 0, nil
1577
+
1578
+ msg = message { var = "blah" }
1579
+
1580
+ assert_nil var
1581
+
1582
+ msg.call
1583
+
1584
+ assert_equal "blah", var
1585
+ end
1586
+
1587
+ def test_pass
1588
+ @tc.pass
1589
+ end
1590
+
1591
+ def test_prints
1592
+ printer = Class.new { extend Minitest::Assertions }
1593
+ @tc.assert_equal '"test"', printer.mu_pp(ImmutableString.new "test")
1594
+ end
1595
+
1596
+ def test_refute
1597
+ @assertion_count = 2
1598
+
1599
+ @tc.assert_equal false, @tc.refute(false), "returns false on success"
1600
+ end
1601
+
1602
+ def test_refute_empty
1603
+ @assertion_count = 2
1604
+
1605
+ @tc.refute_empty [1]
1606
+ end
1607
+
1608
+ def test_refute_empty_triggered
1609
+ @assertion_count = 2
1610
+
1611
+ assert_triggered "Expected [] to not be empty." do
1612
+ @tc.refute_empty []
1613
+ end
1614
+ end
1615
+
1616
+ def test_refute_equal
1617
+ @tc.refute_equal "blah", "yay"
1618
+ end
1619
+
1620
+ def test_refute_equal_triggered
1621
+ assert_triggered 'Expected "blah" to not be equal to "blah".' do
1622
+ @tc.refute_equal "blah", "blah"
1623
+ end
1624
+ end
1625
+
1626
+ def test_refute_in_delta
1627
+ @tc.refute_in_delta 0.0, 1.0 / 1000, 0.000001
1628
+ end
1629
+
1630
+ def test_refute_in_delta_triggered
1631
+ x = maglev? ? "0.100000xxx" : "0.1"
1632
+ assert_triggered "Expected |0.0 - 0.001| (0.001) to not be <= #{x}." do
1633
+ @tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
1634
+ end
1635
+ end
1636
+
1637
+ def test_refute_in_epsilon
1638
+ @tc.refute_in_epsilon 10_000, 9990-1
1639
+ end
1640
+
1641
+ def test_refute_in_epsilon_triggered
1642
+ assert_triggered "Expected |10000 - 9990| (10) to not be <= 10.0." do
1643
+ @tc.refute_in_epsilon 10_000, 9990
1644
+ flunk
1645
+ end
1646
+ end
1647
+
1648
+ def test_refute_includes
1649
+ @assertion_count = 2
1650
+
1651
+ @tc.refute_includes [true], false
1652
+ end
1653
+
1654
+ def test_refute_includes_triggered
1655
+ @assertion_count = 3
1656
+
1657
+ e = @tc.assert_raises Minitest::Assertion do
1658
+ @tc.refute_includes [true], true
1659
+ end
1660
+
1661
+ expected = "Expected [true] to not include true."
1662
+ assert_equal expected, e.message
1663
+ end
1664
+
1665
+ def test_refute_instance_of
1666
+ @tc.refute_instance_of Array, "blah"
1667
+ end
1668
+
1669
+ def test_refute_instance_of_triggered
1670
+ assert_triggered 'Expected "blah" to not be an instance of String.' do
1671
+ @tc.refute_instance_of String, "blah"
1672
+ end
1673
+ end
1674
+
1675
+ def test_refute_kind_of
1676
+ @tc.refute_kind_of Array, "blah"
1677
+ end
1678
+
1679
+ def test_refute_kind_of_triggered
1680
+ assert_triggered 'Expected "blah" to not be a kind of String.' do
1681
+ @tc.refute_kind_of String, "blah"
1682
+ end
1683
+ end
1684
+
1685
+ def test_refute_match
1686
+ @assertion_count = 2
1687
+ @tc.refute_match(/\d+/, "blah blah blah")
1688
+ end
1689
+
1690
+ def test_refute_match_matcher_object
1691
+ @assertion_count = 2
1692
+ @tc.refute_match Object.new, 5 # default #=~ returns false
1693
+ end
1694
+
1695
+ def test_refute_match_object_triggered
1696
+ @assertion_count = 2
1697
+
1698
+ pattern = Object.new
1699
+ def pattern.=~(_) true end
1700
+ def pattern.inspect; "[Object]" end
1701
+
1702
+ assert_triggered "Expected [Object] to not match 5." do
1703
+ @tc.refute_match pattern, 5
1704
+ end
1705
+ end
1706
+
1707
+ def test_refute_match_triggered
1708
+ @assertion_count = 2
1709
+ assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do
1710
+ @tc.refute_match(/\w+/, "blah blah blah")
1711
+ end
1712
+ end
1713
+
1714
+ def test_refute_nil
1715
+ @tc.refute_nil 42
1716
+ end
1717
+
1718
+ def test_refute_nil_triggered
1719
+ assert_triggered "Expected nil to not be nil." do
1720
+ @tc.refute_nil nil
1721
+ end
1722
+ end
1723
+
1724
+ def test_refute_predicate
1725
+ @tc.refute_predicate "42", :empty?
1726
+ end
1727
+
1728
+ def test_refute_predicate_triggered
1729
+ assert_triggered 'Expected "" to not be empty?.' do
1730
+ @tc.refute_predicate "", :empty?
1731
+ end
1732
+ end
1733
+
1734
+ def test_refute_operator
1735
+ @tc.refute_operator 2, :<, 1
1736
+ end
1737
+
1738
+ def test_refute_operator_bad_object
1739
+ bad = Object.new
1740
+ def bad.==(_) true end
1741
+
1742
+ @tc.refute_operator true, :equal?, bad
1743
+ end
1744
+
1745
+ def test_refute_operator_triggered
1746
+ assert_triggered "Expected 2 to not be > 1." do
1747
+ @tc.refute_operator 2, :>, 1
1748
+ end
1749
+ end
1750
+
1751
+ def test_refute_respond_to
1752
+ @tc.refute_respond_to "blah", :rawr!
1753
+ end
1754
+
1755
+ def test_refute_respond_to_triggered
1756
+ assert_triggered 'Expected "blah" to not respond to empty?.' do
1757
+ @tc.refute_respond_to "blah", :empty?
1758
+ end
1759
+ end
1760
+
1761
+ def test_refute_same
1762
+ @tc.refute_same 1, 2
1763
+ end
1764
+
1765
+ def test_refute_same_triggered
1766
+ assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
1767
+ @tc.refute_same 1, 1
1768
+ end
1769
+ end
1770
+
1771
+ def test_skip
1772
+ @assertion_count = 0
1773
+
1774
+ assert_triggered "haha!", Minitest::Skip do
1775
+ @tc.skip "haha!"
1776
+ end
1777
+ end
1778
+
1779
+ def test_runnable_methods_random
1780
+ @assertion_count = 0
1781
+
1782
+ sample_test_case = Class.new Minitest::Test do
1783
+ def self.test_order; :random; end
1784
+ def test_test1; assert "does not matter" end
1785
+ def test_test2; assert "does not matter" end
1786
+ def test_test3; assert "does not matter" end
1787
+ end
1788
+
1789
+ srand 42
1790
+ expected = case
1791
+ when maglev? then
1792
+ %w[test_test2 test_test3 test_test1]
1793
+ else
1794
+ %w[test_test2 test_test1 test_test3]
1795
+ end
1796
+ assert_equal expected, sample_test_case.runnable_methods
1797
+ end
1798
+
1799
+ def test_runnable_methods_sorted
1800
+ @assertion_count = 0
1801
+
1802
+ sample_test_case = Class.new Minitest::Test do
1803
+ def self.test_order; :sorted end
1804
+ def test_test3; assert "does not matter" end
1805
+ def test_test2; assert "does not matter" end
1806
+ def test_test1; assert "does not matter" end
1807
+ end
1808
+
1809
+ expected = %w[test_test1 test_test2 test_test3]
1810
+ assert_equal expected, sample_test_case.runnable_methods
1811
+ end
1812
+
1813
+ def test_i_suck_and_my_tests_are_order_dependent_bang_sets_test_order_alpha
1814
+ @assertion_count = 0
1815
+
1816
+ shitty_test_case = Class.new Minitest::Test
1817
+
1818
+ shitty_test_case.i_suck_and_my_tests_are_order_dependent!
1819
+
1820
+ assert_equal :alpha, shitty_test_case.test_order
1821
+ end
1822
+
1823
+ def test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn
1824
+ @assertion_count = 0
1825
+
1826
+ shitty_test_case = Class.new Minitest::Test
1827
+
1828
+ def shitty_test_case.test_order; :lol end
1829
+
1830
+ assert_silent do
1831
+ shitty_test_case.i_suck_and_my_tests_are_order_dependent!
1832
+ end
1833
+ end
1834
+
1835
+ def assert_triggered expected, klass = Minitest::Assertion
1836
+ e = assert_raises klass do
1837
+ yield
1838
+ end
1839
+
1840
+ msg = e.message.sub(/(---Backtrace---).*/m, '\1')
1841
+ msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")
1842
+ msg.gsub!(/(\d\.\d{6})\d+/, '\1xxx') # normalize: ruby version, impl, platform
1843
+
1844
+ assert_equal expected, msg
1845
+ end
1846
+
1847
+ def util_msg exp, act, msg = nil
1848
+ s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}"
1849
+ s = "#{msg}.\n#{s}" if msg
1850
+ s
1851
+ end
1852
+
1853
+ def without_diff
1854
+ old_diff = Minitest::Assertions.diff
1855
+ Minitest::Assertions.diff = nil
1856
+
1857
+ yield
1858
+ ensure
1859
+ Minitest::Assertions.diff = old_diff
1860
+ end
1861
+ end
1862
+
1863
+ class TestMinitestGuard < Minitest::Test
1864
+ parallelize_me!
1865
+
1866
+ def test_mri_eh
1867
+ assert self.class.mri? "ruby blah"
1868
+ assert self.mri? "ruby blah"
1869
+ end
1870
+
1871
+ def test_jruby_eh
1872
+ assert self.class.jruby? "java"
1873
+ assert self.jruby? "java"
1874
+ end
1875
+
1876
+ def test_rubinius_eh
1877
+ assert self.class.rubinius? "rbx"
1878
+ assert self.rubinius? "rbx"
1879
+ end
1880
+
1881
+ def test_windows_eh
1882
+ assert self.class.windows? "mswin"
1883
+ assert self.windows? "mswin"
1884
+ end
1885
+ end
1886
+
1887
+ class TestMinitestUnitRecording < MetaMetaMetaTestCase
1888
+ # do not parallelize this suite... it just can't handle it.
1889
+
1890
+ def assert_run_record(*expected, &block)
1891
+ @tu = Class.new Minitest::Test, &block
1892
+
1893
+ run_tu_with_fresh_reporter
1894
+
1895
+ recorded = first_reporter.results.map(&:failures).flatten.map { |f| f.error.class }
1896
+
1897
+ assert_equal expected, recorded
1898
+ end
1899
+
1900
+ def test_record_passing
1901
+ assert_run_record do
1902
+ def test_method
1903
+ assert true
1904
+ end
1905
+ end
1906
+ end
1907
+
1908
+ def test_record_failing
1909
+ assert_run_record Minitest::Assertion do
1910
+ def test_method
1911
+ assert false
1912
+ end
1913
+ end
1914
+ end
1915
+
1916
+ def test_record_error
1917
+ assert_run_record RuntimeError do
1918
+ def test_method
1919
+ raise "unhandled exception"
1920
+ end
1921
+ end
1922
+ end
1923
+
1924
+ def test_record_error_teardown
1925
+ assert_run_record RuntimeError do
1926
+ def test_method
1927
+ assert true
1928
+ end
1929
+
1930
+ def teardown
1931
+ raise "unhandled exception"
1932
+ end
1933
+ end
1934
+ end
1935
+
1936
+ def test_record_error_in_test_and_teardown
1937
+ assert_run_record AnError, RuntimeError do
1938
+ def test_method
1939
+ raise AnError
1940
+ end
1941
+
1942
+ def teardown
1943
+ raise "unhandled exception"
1944
+ end
1945
+ end
1946
+ end
1947
+
1948
+ def test_to_s_error_in_test_and_teardown
1949
+ @tu = Class.new Minitest::Test do
1950
+ def test_method
1951
+ raise AnError
1952
+ end
1953
+
1954
+ def teardown
1955
+ raise "unhandled exception"
1956
+ end
1957
+ end
1958
+
1959
+ run_tu_with_fresh_reporter
1960
+
1961
+ exp = clean "
1962
+ Error:
1963
+ #<Class:0xXXX>#test_method:
1964
+ AnError: AnError
1965
+ FILE:LINE:in `test_method'
1966
+
1967
+ Error:
1968
+ #<Class:0xXXX>#test_method:
1969
+ RuntimeError: unhandled exception
1970
+ FILE:LINE:in `teardown'
1971
+ "
1972
+
1973
+ assert_equal exp.strip, normalize_output(first_reporter.results.first.to_s).strip
1974
+ end
1975
+
1976
+ def test_record_skip
1977
+ assert_run_record Minitest::Skip do
1978
+ def test_method
1979
+ skip "not yet"
1980
+ end
1981
+ end
1982
+ end
1983
+ end