mercadopago-custom-checkout 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.gs/bin/rake +23 -0
- data/.gs/cache/faraday-0.9.2.gem +0 -0
- data/.gs/cache/minitest-5.9.0.gem +0 -0
- data/.gs/cache/multi_json-1.12.1.gem +0 -0
- data/.gs/cache/multipart-post-2.0.0.gem +0 -0
- data/.gs/cache/rake-10.5.0.gem +0 -0
- data/.gs/gems/faraday-0.9.2/LICENSE.md +20 -0
- data/.gs/gems/faraday-0.9.2/README.md +245 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday.rb +268 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter.rb +46 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http.rb +237 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http_ssl_patch.rb +56 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony.rb +100 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony/parallel_manager.rb +66 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/excon.rb +81 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/httpclient.rb +117 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb +130 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb +49 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/patron.rb +78 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/rack.rb +58 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/test.rb +162 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/typhoeus.rb +123 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/autoload.rb +84 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/connection.rb +437 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/error.rb +53 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/middleware.rb +37 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/options.rb +359 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/parameters.rb +197 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/rack_builder.rb +213 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request.rb +92 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/authorization.rb +42 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/basic_authentication.rb +13 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/instrumentation.rb +36 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/multipart.rb +63 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/retry.rb +154 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/token_authentication.rb +15 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb +36 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/response.rb +93 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/response/logger.rb +59 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/response/raise_error.rb +21 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/upload_io.rb +67 -0
- data/.gs/gems/faraday-0.9.2/lib/faraday/utils.rb +309 -0
- data/.gs/gems/minitest-5.9.0/.autotest +34 -0
- data/.gs/gems/minitest-5.9.0/History.rdoc +1176 -0
- data/.gs/gems/minitest-5.9.0/Manifest.txt +26 -0
- data/.gs/gems/minitest-5.9.0/README.rdoc +656 -0
- data/.gs/gems/minitest-5.9.0/Rakefile +72 -0
- data/.gs/gems/minitest-5.9.0/design_rationale.rb +52 -0
- data/.gs/gems/minitest-5.9.0/lib/hoe/minitest.rb +26 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest.rb +815 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/assertions.rb +674 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/autorun.rb +13 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/benchmark.rb +424 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/expectations.rb +284 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/hell.rb +17 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/mock.rb +232 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/parallel.rb +69 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/pride.rb +4 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/pride_plugin.rb +142 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/spec.rb +331 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/test.rb +284 -0
- data/.gs/gems/minitest-5.9.0/lib/minitest/unit.rb +45 -0
- data/.gs/gems/minitest-5.9.0/test/minitest/metametameta.rb +90 -0
- data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_benchmark.rb +137 -0
- data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_mock.rb +512 -0
- data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_reporter.rb +281 -0
- data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_spec.rb +967 -0
- data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_test.rb +1983 -0
- data/.gs/gems/multi_json-1.12.1/CHANGELOG.md +245 -0
- data/.gs/gems/multi_json-1.12.1/CONTRIBUTING.md +46 -0
- data/.gs/gems/multi_json-1.12.1/LICENSE.md +20 -0
- data/.gs/gems/multi_json-1.12.1/README.md +121 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json.rb +161 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter.rb +49 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter_error.rb +15 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/gson.rb +20 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/jr_jackson.rb +25 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_common.rb +23 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_gem.rb +11 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_pure.rb +11 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/nsjsonserialization.rb +32 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/oj.rb +25 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/ok_json.rb +23 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/yajl.rb +19 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/convertible_hash_keys.rb +43 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/options.rb +39 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/options_cache.rb +29 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/parse_error.rb +17 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/vendor/okjson.rb +606 -0
- data/.gs/gems/multi_json-1.12.1/lib/multi_json/version.rb +17 -0
- data/.gs/gems/multi_json-1.12.1/multi_json.gemspec +20 -0
- data/.gs/gems/multipart-post-2.0.0/.gitignore +6 -0
- data/.gs/gems/multipart-post-2.0.0/.travis.yml +7 -0
- data/.gs/gems/multipart-post-2.0.0/Gemfile +14 -0
- data/.gs/gems/multipart-post-2.0.0/History.txt +60 -0
- data/.gs/gems/multipart-post-2.0.0/Manifest.txt +9 -0
- data/.gs/gems/multipart-post-2.0.0/README.md +77 -0
- data/.gs/gems/multipart-post-2.0.0/Rakefile +9 -0
- data/.gs/gems/multipart-post-2.0.0/lib/composite_io.rb +108 -0
- data/.gs/gems/multipart-post-2.0.0/lib/multipart_post.rb +9 -0
- data/.gs/gems/multipart-post-2.0.0/lib/multipartable.rb +29 -0
- data/.gs/gems/multipart-post-2.0.0/lib/net/http/post/multipart.rb +27 -0
- data/.gs/gems/multipart-post-2.0.0/lib/parts.rb +96 -0
- data/.gs/gems/multipart-post-2.0.0/multipart-post.gemspec +22 -0
- data/.gs/gems/multipart-post-2.0.0/test/multibyte.txt +1 -0
- data/.gs/gems/multipart-post-2.0.0/test/net/http/post/test_multipart.rb +110 -0
- data/.gs/gems/multipart-post-2.0.0/test/test_composite_io.rb +115 -0
- data/.gs/gems/multipart-post-2.0.0/test/test_parts.rb +86 -0
- data/.gs/gems/rake-10.5.0/.autotest +7 -0
- data/.gs/gems/rake-10.5.0/.rubocop.yml +27 -0
- data/.gs/gems/rake-10.5.0/.togglerc +7 -0
- data/.gs/gems/rake-10.5.0/CONTRIBUTING.rdoc +38 -0
- data/.gs/gems/rake-10.5.0/History.rdoc +659 -0
- data/.gs/gems/rake-10.5.0/MIT-LICENSE +21 -0
- data/.gs/gems/rake-10.5.0/Manifest.txt +166 -0
- data/.gs/gems/rake-10.5.0/README.rdoc +139 -0
- data/.gs/gems/rake-10.5.0/Rakefile +81 -0
- data/.gs/gems/rake-10.5.0/bin/rake +33 -0
- data/.gs/gems/rake-10.5.0/doc/command_line_usage.rdoc +158 -0
- data/.gs/gems/rake-10.5.0/doc/example/Rakefile1 +38 -0
- data/.gs/gems/rake-10.5.0/doc/example/Rakefile2 +35 -0
- data/.gs/gems/rake-10.5.0/doc/example/a.c +6 -0
- data/.gs/gems/rake-10.5.0/doc/example/b.c +6 -0
- data/.gs/gems/rake-10.5.0/doc/example/main.c +11 -0
- data/.gs/gems/rake-10.5.0/doc/glossary.rdoc +42 -0
- data/.gs/gems/rake-10.5.0/doc/jamis.rb +591 -0
- data/.gs/gems/rake-10.5.0/doc/proto_rake.rdoc +127 -0
- data/.gs/gems/rake-10.5.0/doc/rake.1 +141 -0
- data/.gs/gems/rake-10.5.0/doc/rakefile.rdoc +624 -0
- data/.gs/gems/rake-10.5.0/doc/rational.rdoc +151 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.6.rdoc +37 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.rdoc +49 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.3.rdoc +102 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.4.rdoc +60 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.5.rdoc +55 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-0.9.6.rdoc +64 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.0.rdoc +178 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.1.rdoc +58 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.2.rdoc +53 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.0.3.rdoc +191 -0
- data/.gs/gems/rake-10.5.0/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/.gs/gems/rake-10.5.0/lib/rake.rb +79 -0
- data/.gs/gems/rake-10.5.0/lib/rake/alt_system.rb +110 -0
- data/.gs/gems/rake-10.5.0/lib/rake/application.rb +790 -0
- data/.gs/gems/rake-10.5.0/lib/rake/backtrace.rb +23 -0
- data/.gs/gems/rake-10.5.0/lib/rake/clean.rb +76 -0
- data/.gs/gems/rake-10.5.0/lib/rake/cloneable.rb +16 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/.document +1 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/compositepublisher.rb +21 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/ftptools.rb +137 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/publisher.rb +81 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/sshpublisher.rb +61 -0
- data/.gs/gems/rake-10.5.0/lib/rake/contrib/sys.rb +4 -0
- data/.gs/gems/rake-10.5.0/lib/rake/cpu_counter.rb +125 -0
- data/.gs/gems/rake-10.5.0/lib/rake/default_loader.rb +14 -0
- data/.gs/gems/rake-10.5.0/lib/rake/dsl_definition.rb +201 -0
- data/.gs/gems/rake-10.5.0/lib/rake/early_time.rb +21 -0
- data/.gs/gems/rake-10.5.0/lib/rake/ext/core.rb +25 -0
- data/.gs/gems/rake-10.5.0/lib/rake/ext/module.rb +2 -0
- data/.gs/gems/rake-10.5.0/lib/rake/ext/pathname.rb +25 -0
- data/.gs/gems/rake-10.5.0/lib/rake/ext/string.rb +175 -0
- data/.gs/gems/rake-10.5.0/lib/rake/ext/time.rb +18 -0
- data/.gs/gems/rake-10.5.0/lib/rake/file_creation_task.rb +24 -0
- data/.gs/gems/rake-10.5.0/lib/rake/file_list.rb +428 -0
- data/.gs/gems/rake-10.5.0/lib/rake/file_task.rb +46 -0
- data/.gs/gems/rake-10.5.0/lib/rake/file_utils.rb +128 -0
- data/.gs/gems/rake-10.5.0/lib/rake/file_utils_ext.rb +144 -0
- data/.gs/gems/rake-10.5.0/lib/rake/gempackagetask.rb +4 -0
- data/.gs/gems/rake-10.5.0/lib/rake/invocation_chain.rb +56 -0
- data/.gs/gems/rake-10.5.0/lib/rake/invocation_exception_mixin.rb +16 -0
- data/.gs/gems/rake-10.5.0/lib/rake/late_time.rb +17 -0
- data/.gs/gems/rake-10.5.0/lib/rake/linked_list.rb +103 -0
- data/.gs/gems/rake-10.5.0/lib/rake/loaders/makefile.rb +53 -0
- data/.gs/gems/rake-10.5.0/lib/rake/multi_task.rb +13 -0
- data/.gs/gems/rake-10.5.0/lib/rake/name_space.rb +38 -0
- data/.gs/gems/rake-10.5.0/lib/rake/packagetask.rb +199 -0
- data/.gs/gems/rake-10.5.0/lib/rake/pathmap.rb +3 -0
- data/.gs/gems/rake-10.5.0/lib/rake/phony.rb +15 -0
- data/.gs/gems/rake-10.5.0/lib/rake/private_reader.rb +20 -0
- data/.gs/gems/rake-10.5.0/lib/rake/promise.rb +99 -0
- data/.gs/gems/rake-10.5.0/lib/rake/pseudo_status.rb +29 -0
- data/.gs/gems/rake-10.5.0/lib/rake/rake_module.rb +38 -0
- data/.gs/gems/rake-10.5.0/lib/rake/rake_test_loader.rb +22 -0
- data/.gs/gems/rake-10.5.0/lib/rake/rdoctask.rb +4 -0
- data/.gs/gems/rake-10.5.0/lib/rake/ruby182_test_unit_fix.rb +29 -0
- data/.gs/gems/rake-10.5.0/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/.gs/gems/rake-10.5.0/lib/rake/runtest.rb +27 -0
- data/.gs/gems/rake-10.5.0/lib/rake/scope.rb +42 -0
- data/.gs/gems/rake-10.5.0/lib/rake/task.rb +383 -0
- data/.gs/gems/rake-10.5.0/lib/rake/task_argument_error.rb +7 -0
- data/.gs/gems/rake-10.5.0/lib/rake/task_arguments.rb +98 -0
- data/.gs/gems/rake-10.5.0/lib/rake/task_manager.rb +307 -0
- data/.gs/gems/rake-10.5.0/lib/rake/tasklib.rb +24 -0
- data/.gs/gems/rake-10.5.0/lib/rake/testtask.rb +213 -0
- data/.gs/gems/rake-10.5.0/lib/rake/thread_history_display.rb +48 -0
- data/.gs/gems/rake-10.5.0/lib/rake/thread_pool.rb +164 -0
- data/.gs/gems/rake-10.5.0/lib/rake/trace_output.rb +22 -0
- data/.gs/gems/rake-10.5.0/lib/rake/version.rb +7 -0
- data/.gs/gems/rake-10.5.0/lib/rake/win32.rb +56 -0
- data/.gs/gems/rake-10.5.0/rakelib/publish.rake +20 -0
- data/.gs/gems/rake-10.5.0/rakelib/test_times.rake +25 -0
- data/.gs/gems/rake-10.5.0/test/file_creation.rb +34 -0
- data/.gs/gems/rake-10.5.0/test/helper.rb +129 -0
- data/.gs/gems/rake-10.5.0/test/support/rakefile_definitions.rb +478 -0
- data/.gs/gems/rake-10.5.0/test/support/ruby_runner.rb +34 -0
- data/.gs/gems/rake-10.5.0/test/test_private_reader.rb +42 -0
- data/.gs/gems/rake-10.5.0/test/test_rake.rb +40 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_application.rb +643 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_application_options.rb +468 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_backtrace.rb +119 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_clean.rb +61 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_cpu_counter.rb +68 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_definitions.rb +84 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_directory_task.rb +76 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_dsl.rb +40 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_early_time.rb +31 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_extension.rb +59 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_file_creation_task.rb +56 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_file_list.rb +670 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_file_list_path_map.rb +8 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_file_task.rb +197 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_file_utils.rb +314 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_ftp_file.rb +74 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_functional.rb +482 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_invocation_chain.rb +64 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_late_time.rb +18 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_linked_list.rb +84 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_makefile_loader.rb +46 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_multi_task.rb +64 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_name_space.rb +57 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_package_task.rb +79 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_path_map.rb +168 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_path_map_explode.rb +34 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_path_map_partial.rb +18 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_pathname_extensions.rb +15 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_pseudo_status.rb +21 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_rake_test_loader.rb +20 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_reduce_compat.rb +26 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_require.rb +40 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_rules.rb +388 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_scope.rb +44 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task.rb +393 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task_argument_parsing.rb +119 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task_arguments.rb +127 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task_lib.rb +9 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task_manager.rb +178 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task_manager_argument_resolution.rb +19 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_task_with_arguments.rb +172 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_test_task.rb +146 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_thread_pool.rb +145 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_top_level_functions.rb +71 -0
- data/.gs/gems/rake-10.5.0/test/test_rake_win32.rb +72 -0
- data/.gs/gems/rake-10.5.0/test/test_thread_history_display.rb +101 -0
- data/.gs/gems/rake-10.5.0/test/test_trace_output.rb +52 -0
- data/.gs/specifications/faraday-0.9.2.gemspec +31 -0
- data/.gs/specifications/minitest-5.9.0.gemspec +39 -0
- data/.gs/specifications/multi_json-1.12.1.gemspec +33 -0
- data/.gs/specifications/multipart-post-2.0.0.gemspec +22 -0
- data/.gs/specifications/rake-10.5.0.gemspec +43 -0
- data/.rubocop.yml +36 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +38 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/mercadopago/core/client.rb +70 -0
- data/lib/mercadopago/core/endpoints.rb +134 -0
- data/lib/mercadopago/core/errors.rb +6 -0
- data/lib/mercadopago/core/gateway.rb +84 -0
- data/lib/mercadopago/custom_checkout.rb +29 -0
- data/lib/mercadopago/custom_checkout/account.rb +162 -0
- data/lib/mercadopago/custom_checkout/card_issuer.rb +20 -0
- data/lib/mercadopago/custom_checkout/card_token.rb +57 -0
- data/lib/mercadopago/custom_checkout/customer.rb +84 -0
- data/lib/mercadopago/custom_checkout/errors.rb +6 -0
- data/lib/mercadopago/custom_checkout/identification_type.rb +19 -0
- data/lib/mercadopago/custom_checkout/payment_method.rb +42 -0
- data/lib/mercadopago/custom_checkout/payments.rb +24 -0
- data/lib/mercadopago/custom_checkout/resource.rb +14 -0
- data/lib/mercadopago/custom_checkout/version.rb +5 -0
- data/mercadopago-custom-checkout.gemspec +30 -0
- metadata +455 -0
@@ -0,0 +1,281 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "minitest/metametameta"
|
3
|
+
|
4
|
+
class TestMinitestReporter < MetaMetaMetaTestCase
|
5
|
+
|
6
|
+
attr_accessor :r, :io
|
7
|
+
|
8
|
+
def new_composite_reporter
|
9
|
+
reporter = Minitest::CompositeReporter.new
|
10
|
+
reporter << Minitest::SummaryReporter.new(self.io)
|
11
|
+
reporter << Minitest::ProgressReporter.new(self.io)
|
12
|
+
|
13
|
+
def reporter.first
|
14
|
+
reporters.first
|
15
|
+
end
|
16
|
+
|
17
|
+
def reporter.results
|
18
|
+
first.results
|
19
|
+
end
|
20
|
+
|
21
|
+
def reporter.count
|
22
|
+
first.count
|
23
|
+
end
|
24
|
+
|
25
|
+
def reporter.assertions
|
26
|
+
first.assertions
|
27
|
+
end
|
28
|
+
|
29
|
+
reporter
|
30
|
+
end
|
31
|
+
|
32
|
+
def setup
|
33
|
+
self.io = StringIO.new("")
|
34
|
+
self.r = new_composite_reporter
|
35
|
+
end
|
36
|
+
|
37
|
+
def error_test
|
38
|
+
unless defined? @et then
|
39
|
+
@et = Minitest::Test.new(:woot)
|
40
|
+
@et.failures << Minitest::UnexpectedError.new(begin
|
41
|
+
raise "no"
|
42
|
+
rescue => e
|
43
|
+
e
|
44
|
+
end)
|
45
|
+
end
|
46
|
+
@et
|
47
|
+
end
|
48
|
+
|
49
|
+
def fail_test
|
50
|
+
unless defined? @ft then
|
51
|
+
@ft = Minitest::Test.new(:woot)
|
52
|
+
@ft.failures << begin
|
53
|
+
raise Minitest::Assertion, "boo"
|
54
|
+
rescue Minitest::Assertion => e
|
55
|
+
e
|
56
|
+
end
|
57
|
+
end
|
58
|
+
@ft
|
59
|
+
end
|
60
|
+
|
61
|
+
def passing_test
|
62
|
+
@pt ||= Minitest::Test.new(:woot)
|
63
|
+
end
|
64
|
+
|
65
|
+
def skip_test
|
66
|
+
unless defined? @st then
|
67
|
+
@st = Minitest::Test.new(:woot)
|
68
|
+
@st.failures << begin
|
69
|
+
raise Minitest::Skip
|
70
|
+
rescue Minitest::Assertion => e
|
71
|
+
e
|
72
|
+
end
|
73
|
+
end
|
74
|
+
@st
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_passed_eh_empty
|
78
|
+
assert r.passed?
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_passed_eh_failure
|
82
|
+
r.results << fail_test
|
83
|
+
|
84
|
+
refute r.passed?
|
85
|
+
end
|
86
|
+
|
87
|
+
SKIP_MSG = "\n\nYou have skipped tests. Run with --verbose for details."
|
88
|
+
|
89
|
+
def test_passed_eh_error
|
90
|
+
r.start
|
91
|
+
|
92
|
+
r.results << error_test
|
93
|
+
|
94
|
+
refute r.passed?
|
95
|
+
|
96
|
+
r.report
|
97
|
+
|
98
|
+
refute_match SKIP_MSG, io.string
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_passed_eh_skipped
|
102
|
+
r.start
|
103
|
+
r.results << skip_test
|
104
|
+
assert r.passed?
|
105
|
+
|
106
|
+
restore_env do
|
107
|
+
r.report
|
108
|
+
end
|
109
|
+
|
110
|
+
assert_match SKIP_MSG, io.string
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_passed_eh_skipped_verbose
|
114
|
+
r.first.options[:verbose] = true
|
115
|
+
|
116
|
+
r.start
|
117
|
+
r.results << skip_test
|
118
|
+
assert r.passed?
|
119
|
+
r.report
|
120
|
+
|
121
|
+
refute_match SKIP_MSG, io.string
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_start
|
125
|
+
r.start
|
126
|
+
|
127
|
+
exp = "Run options: \n\n# Running:\n\n"
|
128
|
+
|
129
|
+
assert_equal exp, io.string
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_record_pass
|
133
|
+
r.record passing_test
|
134
|
+
|
135
|
+
assert_equal ".", io.string
|
136
|
+
assert_empty r.results
|
137
|
+
assert_equal 1, r.count
|
138
|
+
assert_equal 0, r.assertions
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_record_fail
|
142
|
+
r.record fail_test
|
143
|
+
|
144
|
+
assert_equal "F", io.string
|
145
|
+
assert_equal [fail_test], r.results
|
146
|
+
assert_equal 1, r.count
|
147
|
+
assert_equal 0, r.assertions
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_record_error
|
151
|
+
r.record error_test
|
152
|
+
|
153
|
+
assert_equal "E", io.string
|
154
|
+
assert_equal [error_test], r.results
|
155
|
+
assert_equal 1, r.count
|
156
|
+
assert_equal 0, r.assertions
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_record_skip
|
160
|
+
r.record skip_test
|
161
|
+
|
162
|
+
assert_equal "S", io.string
|
163
|
+
assert_equal [skip_test], r.results
|
164
|
+
assert_equal 1, r.count
|
165
|
+
assert_equal 0, r.assertions
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_report_empty
|
169
|
+
r.start
|
170
|
+
r.report
|
171
|
+
|
172
|
+
exp = clean <<-EOM
|
173
|
+
Run options:
|
174
|
+
|
175
|
+
# Running:
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
Finished in 0.00
|
180
|
+
|
181
|
+
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
|
182
|
+
EOM
|
183
|
+
|
184
|
+
assert_equal exp, normalize_output(io.string)
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_report_passing
|
188
|
+
r.start
|
189
|
+
r.record passing_test
|
190
|
+
r.report
|
191
|
+
|
192
|
+
exp = clean <<-EOM
|
193
|
+
Run options:
|
194
|
+
|
195
|
+
# Running:
|
196
|
+
|
197
|
+
.
|
198
|
+
|
199
|
+
Finished in 0.00
|
200
|
+
|
201
|
+
1 runs, 0 assertions, 0 failures, 0 errors, 0 skips
|
202
|
+
EOM
|
203
|
+
|
204
|
+
assert_equal exp, normalize_output(io.string)
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_report_failure
|
208
|
+
r.start
|
209
|
+
r.record fail_test
|
210
|
+
r.report
|
211
|
+
|
212
|
+
exp = clean <<-EOM
|
213
|
+
Run options:
|
214
|
+
|
215
|
+
# Running:
|
216
|
+
|
217
|
+
F
|
218
|
+
|
219
|
+
Finished in 0.00
|
220
|
+
|
221
|
+
1) Failure:
|
222
|
+
Minitest::Test#woot [FILE:LINE]:
|
223
|
+
boo
|
224
|
+
|
225
|
+
1 runs, 0 assertions, 1 failures, 0 errors, 0 skips
|
226
|
+
EOM
|
227
|
+
|
228
|
+
assert_equal exp, normalize_output(io.string)
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_report_error
|
232
|
+
r.start
|
233
|
+
r.record error_test
|
234
|
+
r.report
|
235
|
+
|
236
|
+
exp = clean <<-EOM
|
237
|
+
Run options:
|
238
|
+
|
239
|
+
# Running:
|
240
|
+
|
241
|
+
E
|
242
|
+
|
243
|
+
Finished in 0.00
|
244
|
+
|
245
|
+
1) Error:
|
246
|
+
Minitest::Test#woot:
|
247
|
+
RuntimeError: no
|
248
|
+
FILE:LINE:in `error_test'
|
249
|
+
FILE:LINE:in `test_report_error'
|
250
|
+
|
251
|
+
1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
|
252
|
+
EOM
|
253
|
+
|
254
|
+
assert_equal exp, normalize_output(io.string)
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_report_skipped
|
258
|
+
r.start
|
259
|
+
r.record skip_test
|
260
|
+
|
261
|
+
restore_env do
|
262
|
+
r.report
|
263
|
+
end
|
264
|
+
|
265
|
+
exp = clean <<-EOM
|
266
|
+
Run options:
|
267
|
+
|
268
|
+
# Running:
|
269
|
+
|
270
|
+
S
|
271
|
+
|
272
|
+
Finished in 0.00
|
273
|
+
|
274
|
+
1 runs, 0 assertions, 0 failures, 0 errors, 1 skips
|
275
|
+
|
276
|
+
You have skipped tests. Run with --verbose for details.
|
277
|
+
EOM
|
278
|
+
|
279
|
+
assert_equal exp, normalize_output(io.string)
|
280
|
+
end
|
281
|
+
end
|
@@ -0,0 +1,967 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "minitest/autorun"
|
3
|
+
require "stringio"
|
4
|
+
|
5
|
+
class MiniSpecA < Minitest::Spec; end
|
6
|
+
class MiniSpecB < Minitest::Test; extend Minitest::Spec::DSL; end
|
7
|
+
class MiniSpecC < MiniSpecB; end
|
8
|
+
class NamedExampleA < MiniSpecA; end
|
9
|
+
class NamedExampleB < MiniSpecB; end
|
10
|
+
class NamedExampleC < MiniSpecC; end
|
11
|
+
class ExampleA; end
|
12
|
+
class ExampleB < ExampleA; end
|
13
|
+
|
14
|
+
describe Minitest::Spec do
|
15
|
+
# do not parallelize this suite... it just can"t handle it.
|
16
|
+
|
17
|
+
def assert_triggered expected = "blah", klass = Minitest::Assertion
|
18
|
+
@assertion_count += 1
|
19
|
+
|
20
|
+
e = assert_raises(klass) do
|
21
|
+
yield
|
22
|
+
end
|
23
|
+
|
24
|
+
msg = e.message.sub(/(---Backtrace---).*/m, '\1')
|
25
|
+
msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")
|
26
|
+
msg.gsub!(/@.+>/, "@PATH>")
|
27
|
+
msg.gsub!(/(\d\.\d{6})\d+/, '\1xxx') # normalize: ruby version, impl, platform
|
28
|
+
msg.gsub!(/:0x[a-fA-F0-9]{4,}/m, ":0xXXXXXX")
|
29
|
+
|
30
|
+
if expected
|
31
|
+
@assertion_count += 1
|
32
|
+
case expected
|
33
|
+
when String then
|
34
|
+
assert_equal expected, msg
|
35
|
+
when Regexp then
|
36
|
+
@assertion_count += 1
|
37
|
+
assert_match expected, msg
|
38
|
+
else
|
39
|
+
flunk "Unknown: #{expected.inspect}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
before do
|
45
|
+
@assertion_count = 4
|
46
|
+
end
|
47
|
+
|
48
|
+
after do
|
49
|
+
_(self.assertions).must_equal @assertion_count if passed? and not skipped?
|
50
|
+
end
|
51
|
+
|
52
|
+
it "needs to be able to catch a Minitest::Assertion exception" do
|
53
|
+
@assertion_count = 1
|
54
|
+
|
55
|
+
assert_triggered "Expected 1 to not be equal to 1." do
|
56
|
+
1.wont_equal 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it "needs to be sensible about must_include order" do
|
61
|
+
@assertion_count += 3 # must_include is 2 assertions
|
62
|
+
|
63
|
+
[1, 2, 3].must_include(2).must_equal true
|
64
|
+
|
65
|
+
assert_triggered "Expected [1, 2, 3] to include 5." do
|
66
|
+
[1, 2, 3].must_include 5
|
67
|
+
end
|
68
|
+
|
69
|
+
assert_triggered "msg.\nExpected [1, 2, 3] to include 5." do
|
70
|
+
[1, 2, 3].must_include 5, "msg"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it "needs to be sensible about wont_include order" do
|
75
|
+
@assertion_count += 3 # wont_include is 2 assertions
|
76
|
+
|
77
|
+
[1, 2, 3].wont_include(5).must_equal false
|
78
|
+
|
79
|
+
assert_triggered "Expected [1, 2, 3] to not include 2." do
|
80
|
+
[1, 2, 3].wont_include 2
|
81
|
+
end
|
82
|
+
|
83
|
+
assert_triggered "msg.\nExpected [1, 2, 3] to not include 2." do
|
84
|
+
[1, 2, 3].wont_include 2, "msg"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
it "needs to catch an expected exception" do
|
89
|
+
@assertion_count = 2
|
90
|
+
|
91
|
+
proc { raise "blah" }.must_raise RuntimeError
|
92
|
+
proc { raise Minitest::Assertion }.must_raise Minitest::Assertion
|
93
|
+
end
|
94
|
+
|
95
|
+
it "needs to catch an unexpected exception" do
|
96
|
+
@assertion_count -= 2 # no positive
|
97
|
+
|
98
|
+
msg = <<-EOM.gsub(/^ {6}/, "").chomp
|
99
|
+
[RuntimeError] exception expected, not
|
100
|
+
Class: <StandardError>
|
101
|
+
Message: <"woot">
|
102
|
+
---Backtrace---
|
103
|
+
EOM
|
104
|
+
|
105
|
+
assert_triggered msg do
|
106
|
+
proc { raise StandardError, "woot" }.must_raise RuntimeError
|
107
|
+
end
|
108
|
+
|
109
|
+
assert_triggered "msg.\n#{msg}" do
|
110
|
+
proc { raise StandardError, "woot" }.must_raise RuntimeError, "msg"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it "needs to ensure silence" do
|
115
|
+
@assertion_count -= 1 # no msg
|
116
|
+
@assertion_count += 2 # assert_output is 2 assertions
|
117
|
+
|
118
|
+
proc { }.must_be_silent.must_equal true
|
119
|
+
|
120
|
+
assert_triggered "In stdout.\nExpected: \"\"\n Actual: \"xxx\"" do
|
121
|
+
proc { print "xxx" }.must_be_silent
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it "needs to have all methods named well" do
|
126
|
+
@assertion_count = 2
|
127
|
+
|
128
|
+
methods = Object.public_instance_methods.find_all { |n| n =~ /^must|^wont/ }
|
129
|
+
methods.map!(&:to_s) if Symbol === methods.first
|
130
|
+
|
131
|
+
musts, wonts = methods.sort.partition { |m| m =~ /^must/ }
|
132
|
+
|
133
|
+
expected_musts = %w[must_be
|
134
|
+
must_be_close_to
|
135
|
+
must_be_empty
|
136
|
+
must_be_instance_of
|
137
|
+
must_be_kind_of
|
138
|
+
must_be_nil
|
139
|
+
must_be_same_as
|
140
|
+
must_be_silent
|
141
|
+
must_be_within_delta
|
142
|
+
must_be_within_epsilon
|
143
|
+
must_equal
|
144
|
+
must_include
|
145
|
+
must_match
|
146
|
+
must_output
|
147
|
+
must_raise
|
148
|
+
must_respond_to
|
149
|
+
must_throw]
|
150
|
+
|
151
|
+
bad = %w[not raise throw send output be_silent]
|
152
|
+
|
153
|
+
expected_wonts = expected_musts.map { |m| m.sub(/^must/, "wont") }
|
154
|
+
expected_wonts.reject! { |m| m =~ /wont_#{Regexp.union(*bad)}/ }
|
155
|
+
|
156
|
+
musts.must_equal expected_musts
|
157
|
+
wonts.must_equal expected_wonts
|
158
|
+
end
|
159
|
+
|
160
|
+
it "needs to raise if an expected exception is not raised" do
|
161
|
+
@assertion_count -= 2 # no positive test
|
162
|
+
|
163
|
+
assert_triggered "RuntimeError expected but nothing was raised." do
|
164
|
+
proc { 42 }.must_raise RuntimeError
|
165
|
+
end
|
166
|
+
|
167
|
+
assert_triggered "msg.\nRuntimeError expected but nothing was raised." do
|
168
|
+
proc { 42 }.must_raise RuntimeError, "msg"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
it "needs to verify binary messages" do
|
173
|
+
42.wont_be(:<, 24).must_equal false
|
174
|
+
|
175
|
+
assert_triggered "Expected 24 to not be < 42." do
|
176
|
+
24.wont_be :<, 42
|
177
|
+
end
|
178
|
+
|
179
|
+
assert_triggered "msg.\nExpected 24 to not be < 42." do
|
180
|
+
24.wont_be :<, 42, "msg"
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
it "needs to verify emptyness" do
|
185
|
+
@assertion_count += 3 # empty is 2 assertions
|
186
|
+
|
187
|
+
[].must_be_empty.must_equal true
|
188
|
+
|
189
|
+
assert_triggered "Expected [42] to be empty." do
|
190
|
+
[42].must_be_empty
|
191
|
+
end
|
192
|
+
|
193
|
+
assert_triggered "msg.\nExpected [42] to be empty." do
|
194
|
+
[42].must_be_empty "msg"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
it "needs to verify equality" do
|
199
|
+
@assertion_count += 1
|
200
|
+
|
201
|
+
(6 * 7).must_equal(42).must_equal true
|
202
|
+
|
203
|
+
assert_triggered "Expected: 42\n Actual: 54" do
|
204
|
+
(6 * 9).must_equal 42
|
205
|
+
end
|
206
|
+
|
207
|
+
assert_triggered "msg.\nExpected: 42\n Actual: 54" do
|
208
|
+
(6 * 9).must_equal 42, "msg"
|
209
|
+
end
|
210
|
+
|
211
|
+
assert_triggered(/^-42\n\+#<Proc:0xXXXXXX@PATH>\n/) do
|
212
|
+
proc { 42 }.must_equal 42 # proc isn't called, so expectation fails
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
it "needs to verify floats outside a delta" do
|
217
|
+
@assertion_count += 1 # extra test
|
218
|
+
|
219
|
+
24.wont_be_close_to(42).must_equal false
|
220
|
+
|
221
|
+
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= 0.001." do
|
222
|
+
(6 * 7.0).wont_be_close_to 42
|
223
|
+
end
|
224
|
+
|
225
|
+
x = maglev? ? "1.0000000000000001e-05" : "1.0e-05"
|
226
|
+
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
227
|
+
(6 * 7.0).wont_be_close_to 42, 0.00001
|
228
|
+
end
|
229
|
+
|
230
|
+
assert_triggered "msg.\nExpected |42 - 42.0| (0.0) to not be <= #{x}." do
|
231
|
+
(6 * 7.0).wont_be_close_to 42, 0.00001, "msg"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
it "needs to verify floats outside an epsilon" do
|
236
|
+
@assertion_count += 1 # extra test
|
237
|
+
|
238
|
+
24.wont_be_within_epsilon(42).must_equal false
|
239
|
+
|
240
|
+
x = maglev? ? "0.042000000000000003" : "0.042"
|
241
|
+
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
242
|
+
(6 * 7.0).wont_be_within_epsilon 42
|
243
|
+
end
|
244
|
+
|
245
|
+
x = maglev? ? "0.00042000000000000002" : "0.00042"
|
246
|
+
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
247
|
+
(6 * 7.0).wont_be_within_epsilon 42, 0.00001
|
248
|
+
end
|
249
|
+
|
250
|
+
assert_triggered "msg.\nExpected |42 - 42.0| (0.0) to not be <= #{x}." do
|
251
|
+
(6 * 7.0).wont_be_within_epsilon 42, 0.00001, "msg"
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
it "needs to verify floats within a delta" do
|
256
|
+
@assertion_count += 1 # extra test
|
257
|
+
|
258
|
+
(6.0 * 7).must_be_close_to(42.0).must_equal true
|
259
|
+
|
260
|
+
assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.001." do
|
261
|
+
(1.0 / 100).must_be_close_to 0.0
|
262
|
+
end
|
263
|
+
|
264
|
+
x = maglev? ? "9.9999999999999995e-07" : "1.0e-06"
|
265
|
+
assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
|
266
|
+
(1.0 / 1000).must_be_close_to 0.0, 0.000001
|
267
|
+
end
|
268
|
+
|
269
|
+
assert_triggered "msg.\nExpected |0.0 - 0.001| (0.001) to be <= #{x}." do
|
270
|
+
(1.0 / 1000).must_be_close_to 0.0, 0.000001, "msg"
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
it "needs to verify floats within an epsilon" do
|
275
|
+
@assertion_count += 1 # extra test
|
276
|
+
|
277
|
+
(6.0 * 7).must_be_within_epsilon(42.0).must_equal true
|
278
|
+
|
279
|
+
assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.0." do
|
280
|
+
(1.0 / 100).must_be_within_epsilon 0.0
|
281
|
+
end
|
282
|
+
|
283
|
+
assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= 0.0." do
|
284
|
+
(1.0 / 1000).must_be_within_epsilon 0.0, 0.000001
|
285
|
+
end
|
286
|
+
|
287
|
+
assert_triggered "msg.\nExpected |0.0 - 0.001| (0.001) to be <= 0.0." do
|
288
|
+
(1.0 / 1000).must_be_within_epsilon 0.0, 0.000001, "msg"
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
it "needs to verify identity" do
|
293
|
+
1.must_be_same_as(1).must_equal true
|
294
|
+
|
295
|
+
assert_triggered "Expected 1 (oid=N) to be the same as 2 (oid=N)." do
|
296
|
+
1.must_be_same_as 2
|
297
|
+
end
|
298
|
+
|
299
|
+
assert_triggered "msg.\nExpected 1 (oid=N) to be the same as 2 (oid=N)." do
|
300
|
+
1.must_be_same_as 2, "msg"
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
it "needs to verify inequality" do
|
305
|
+
@assertion_count += 2
|
306
|
+
42.wont_equal(6 * 9).must_equal false
|
307
|
+
proc{}.wont_equal(42).must_equal false
|
308
|
+
|
309
|
+
assert_triggered "Expected 1 to not be equal to 1." do
|
310
|
+
1.wont_equal 1
|
311
|
+
end
|
312
|
+
|
313
|
+
assert_triggered "msg.\nExpected 1 to not be equal to 1." do
|
314
|
+
1.wont_equal 1, "msg"
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
it "needs to verify instances of a class" do
|
319
|
+
42.wont_be_instance_of(String).must_equal false
|
320
|
+
|
321
|
+
assert_triggered "Expected 42 to not be an instance of Fixnum." do
|
322
|
+
42.wont_be_instance_of Fixnum
|
323
|
+
end
|
324
|
+
|
325
|
+
assert_triggered "msg.\nExpected 42 to not be an instance of Fixnum." do
|
326
|
+
42.wont_be_instance_of Fixnum, "msg"
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
it "needs to verify kinds of a class" do
|
331
|
+
@assertion_count += 2
|
332
|
+
|
333
|
+
42.wont_be_kind_of(String).must_equal false
|
334
|
+
proc{}.wont_be_kind_of(String).must_equal false
|
335
|
+
|
336
|
+
assert_triggered "Expected 42 to not be a kind of Integer." do
|
337
|
+
42.wont_be_kind_of Integer
|
338
|
+
end
|
339
|
+
|
340
|
+
assert_triggered "msg.\nExpected 42 to not be a kind of Integer." do
|
341
|
+
42.wont_be_kind_of Integer, "msg"
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
it "needs to verify kinds of objects" do
|
346
|
+
@assertion_count += 3 # extra test
|
347
|
+
|
348
|
+
(6 * 7).must_be_kind_of(Fixnum).must_equal true
|
349
|
+
(6 * 7).must_be_kind_of(Numeric).must_equal true
|
350
|
+
|
351
|
+
assert_triggered "Expected 42 to be a kind of String, not Fixnum." do
|
352
|
+
(6 * 7).must_be_kind_of String
|
353
|
+
end
|
354
|
+
|
355
|
+
assert_triggered "msg.\nExpected 42 to be a kind of String, not Fixnum." do
|
356
|
+
(6 * 7).must_be_kind_of String, "msg"
|
357
|
+
end
|
358
|
+
|
359
|
+
exp = "Expected #<Proc:0xXXXXXX@PATH> to be a kind of String, not Proc."
|
360
|
+
assert_triggered exp do
|
361
|
+
proc{}.must_be_kind_of String
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
it "needs to verify mismatch" do
|
366
|
+
@assertion_count += 3 # match is 2
|
367
|
+
|
368
|
+
"blah".wont_match(/\d+/).must_equal false
|
369
|
+
|
370
|
+
assert_triggered "Expected /\\w+/ to not match \"blah\"." do
|
371
|
+
"blah".wont_match(/\w+/)
|
372
|
+
end
|
373
|
+
|
374
|
+
assert_triggered "msg.\nExpected /\\w+/ to not match \"blah\"." do
|
375
|
+
"blah".wont_match(/\w+/, "msg")
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
it "needs to verify nil" do
|
380
|
+
nil.must_be_nil.must_equal true
|
381
|
+
|
382
|
+
assert_triggered "Expected 42 to be nil." do
|
383
|
+
42.must_be_nil
|
384
|
+
end
|
385
|
+
|
386
|
+
assert_triggered "msg.\nExpected 42 to be nil." do
|
387
|
+
42.must_be_nil "msg"
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
it "needs to verify non-emptyness" do
|
392
|
+
@assertion_count += 3 # empty is 2 assertions
|
393
|
+
|
394
|
+
["some item"].wont_be_empty.must_equal false
|
395
|
+
|
396
|
+
assert_triggered "Expected [] to not be empty." do
|
397
|
+
[].wont_be_empty
|
398
|
+
end
|
399
|
+
|
400
|
+
assert_triggered "msg.\nExpected [] to not be empty." do
|
401
|
+
[].wont_be_empty "msg"
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
it "needs to verify non-identity" do
|
406
|
+
1.wont_be_same_as(2).must_equal false
|
407
|
+
|
408
|
+
assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
|
409
|
+
1.wont_be_same_as 1
|
410
|
+
end
|
411
|
+
|
412
|
+
assert_triggered "msg.\nExpected 1 (oid=N) to not be the same as 1 (oid=N)." do
|
413
|
+
1.wont_be_same_as 1, "msg"
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
it "needs to verify non-nil" do
|
418
|
+
42.wont_be_nil.must_equal false
|
419
|
+
|
420
|
+
assert_triggered "Expected nil to not be nil." do
|
421
|
+
nil.wont_be_nil
|
422
|
+
end
|
423
|
+
|
424
|
+
assert_triggered "msg.\nExpected nil to not be nil." do
|
425
|
+
nil.wont_be_nil "msg"
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
it "needs to verify objects not responding to a message" do
|
430
|
+
"".wont_respond_to(:woot!).must_equal false
|
431
|
+
|
432
|
+
assert_triggered "Expected \"\" to not respond to to_s." do
|
433
|
+
"".wont_respond_to :to_s
|
434
|
+
end
|
435
|
+
|
436
|
+
assert_triggered "msg.\nExpected \"\" to not respond to to_s." do
|
437
|
+
"".wont_respond_to :to_s, "msg"
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
it "needs to verify output in stderr" do
|
442
|
+
@assertion_count -= 1 # no msg
|
443
|
+
|
444
|
+
proc { $stderr.print "blah" }.must_output(nil, "blah").must_equal true
|
445
|
+
|
446
|
+
assert_triggered "In stderr.\nExpected: \"blah\"\n Actual: \"xxx\"" do
|
447
|
+
proc { $stderr.print "xxx" }.must_output(nil, "blah")
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
451
|
+
it "needs to verify output in stdout" do
|
452
|
+
@assertion_count -= 1 # no msg
|
453
|
+
|
454
|
+
proc { print "blah" }.must_output("blah").must_equal true
|
455
|
+
|
456
|
+
assert_triggered "In stdout.\nExpected: \"blah\"\n Actual: \"xxx\"" do
|
457
|
+
proc { print "xxx" }.must_output("blah")
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
it "needs to verify regexp matches" do
|
462
|
+
@assertion_count += 3 # must_match is 2 assertions
|
463
|
+
|
464
|
+
"blah".must_match(/\w+/).must_equal true
|
465
|
+
|
466
|
+
assert_triggered "Expected /\\d+/ to match \"blah\"." do
|
467
|
+
"blah".must_match(/\d+/)
|
468
|
+
end
|
469
|
+
|
470
|
+
assert_triggered "msg.\nExpected /\\d+/ to match \"blah\"." do
|
471
|
+
"blah".must_match(/\d+/, "msg")
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
describe "expect" do
|
476
|
+
before do
|
477
|
+
@assertion_count -= 3
|
478
|
+
end
|
479
|
+
|
480
|
+
it "can use expect" do
|
481
|
+
_(1 + 1).must_equal 2
|
482
|
+
end
|
483
|
+
|
484
|
+
it "can use expect with a lambda" do
|
485
|
+
_ { raise "blah" }.must_raise RuntimeError
|
486
|
+
end
|
487
|
+
|
488
|
+
it "can use expect in a thread" do
|
489
|
+
Thread.new { _(1 + 1).must_equal 2 }.join
|
490
|
+
end
|
491
|
+
|
492
|
+
it "can NOT use must_equal in a thread. It must use expect in a thread" do
|
493
|
+
assert_raises NoMethodError do
|
494
|
+
Thread.new { (1 + 1).must_equal 2 }.join
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
it "needs to verify throw" do
|
500
|
+
@assertion_count += 2 # 2 extra tests
|
501
|
+
|
502
|
+
proc { throw :blah }.must_throw(:blah).must_equal true
|
503
|
+
|
504
|
+
assert_triggered "Expected :blah to have been thrown." do
|
505
|
+
proc { }.must_throw :blah
|
506
|
+
end
|
507
|
+
|
508
|
+
assert_triggered "Expected :blah to have been thrown, not :xxx." do
|
509
|
+
proc { throw :xxx }.must_throw :blah
|
510
|
+
end
|
511
|
+
|
512
|
+
assert_triggered "msg.\nExpected :blah to have been thrown." do
|
513
|
+
proc { }.must_throw :blah, "msg"
|
514
|
+
end
|
515
|
+
|
516
|
+
assert_triggered "msg.\nExpected :blah to have been thrown, not :xxx." do
|
517
|
+
proc { throw :xxx }.must_throw :blah, "msg"
|
518
|
+
end
|
519
|
+
end
|
520
|
+
|
521
|
+
it "needs to verify types of objects" do
|
522
|
+
(6 * 7).must_be_instance_of(Fixnum).must_equal true
|
523
|
+
|
524
|
+
exp = "Expected 42 to be an instance of String, not Fixnum."
|
525
|
+
|
526
|
+
assert_triggered exp do
|
527
|
+
(6 * 7).must_be_instance_of String
|
528
|
+
end
|
529
|
+
|
530
|
+
assert_triggered "msg.\n#{exp}" do
|
531
|
+
(6 * 7).must_be_instance_of String, "msg"
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
it "needs to verify using any (negative) predicate" do
|
536
|
+
@assertion_count -= 1 # doesn"t take a message
|
537
|
+
|
538
|
+
"blah".wont_be(:empty?).must_equal false
|
539
|
+
|
540
|
+
assert_triggered "Expected \"\" to not be empty?." do
|
541
|
+
"".wont_be :empty?
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
it "needs to verify using any binary operator" do
|
546
|
+
@assertion_count -= 1 # no msg
|
547
|
+
|
548
|
+
41.must_be(:<, 42).must_equal true
|
549
|
+
|
550
|
+
assert_triggered "Expected 42 to be < 41." do
|
551
|
+
42.must_be(:<, 41)
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
it "needs to verify using any predicate" do
|
556
|
+
@assertion_count -= 1 # no msg
|
557
|
+
|
558
|
+
"".must_be(:empty?).must_equal true
|
559
|
+
|
560
|
+
assert_triggered "Expected \"blah\" to be empty?." do
|
561
|
+
"blah".must_be :empty?
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
it "needs to verify using respond_to" do
|
566
|
+
42.must_respond_to(:+).must_equal true
|
567
|
+
|
568
|
+
assert_triggered "Expected 42 (Fixnum) to respond to #clear." do
|
569
|
+
42.must_respond_to :clear
|
570
|
+
end
|
571
|
+
|
572
|
+
assert_triggered "msg.\nExpected 42 (Fixnum) to respond to #clear." do
|
573
|
+
42.must_respond_to :clear, "msg"
|
574
|
+
end
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
578
|
+
describe Minitest::Spec, :let do
|
579
|
+
i_suck_and_my_tests_are_order_dependent!
|
580
|
+
|
581
|
+
def _count
|
582
|
+
$let_count ||= 0
|
583
|
+
end
|
584
|
+
|
585
|
+
let :count do
|
586
|
+
$let_count += 1
|
587
|
+
$let_count
|
588
|
+
end
|
589
|
+
|
590
|
+
it "is evaluated once per example" do
|
591
|
+
_count.must_equal 0
|
592
|
+
|
593
|
+
count.must_equal 1
|
594
|
+
count.must_equal 1
|
595
|
+
|
596
|
+
_count.must_equal 1
|
597
|
+
end
|
598
|
+
|
599
|
+
it "is REALLY evaluated once per example" do
|
600
|
+
_count.must_equal 1
|
601
|
+
|
602
|
+
count.must_equal 2
|
603
|
+
count.must_equal 2
|
604
|
+
|
605
|
+
_count.must_equal 2
|
606
|
+
end
|
607
|
+
|
608
|
+
it 'raises an error if the name begins with "test"' do
|
609
|
+
proc { self.class.let(:test_value) { true } }.must_raise ArgumentError
|
610
|
+
end
|
611
|
+
|
612
|
+
it "raises an error if the name shadows a normal instance method" do
|
613
|
+
proc { self.class.let(:message) { true } }.must_raise ArgumentError
|
614
|
+
end
|
615
|
+
|
616
|
+
it "doesn't raise an error if it is just another let" do
|
617
|
+
proc do
|
618
|
+
describe :outer do
|
619
|
+
let(:bar)
|
620
|
+
describe :inner do
|
621
|
+
let(:bar)
|
622
|
+
end
|
623
|
+
end
|
624
|
+
:good
|
625
|
+
end.call.must_equal :good
|
626
|
+
end
|
627
|
+
|
628
|
+
it "procs come after dont_flip" do
|
629
|
+
p = proc { }
|
630
|
+
assert_respond_to p, :call
|
631
|
+
p.must_respond_to :call
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
describe Minitest::Spec, :subject do
|
636
|
+
attr_reader :subject_evaluation_count
|
637
|
+
|
638
|
+
subject do
|
639
|
+
@subject_evaluation_count ||= 0
|
640
|
+
@subject_evaluation_count += 1
|
641
|
+
@subject_evaluation_count
|
642
|
+
end
|
643
|
+
|
644
|
+
it "is evaluated once per example" do
|
645
|
+
subject.must_equal 1
|
646
|
+
subject.must_equal 1
|
647
|
+
subject_evaluation_count.must_equal 1
|
648
|
+
end
|
649
|
+
end
|
650
|
+
|
651
|
+
class TestMetaStatic < Minitest::Test
|
652
|
+
def test_children
|
653
|
+
Minitest::Spec.children.clear # prevents parallel run
|
654
|
+
|
655
|
+
y = z = nil
|
656
|
+
x = describe "top-level thingy" do
|
657
|
+
y = describe "first thingy" do end
|
658
|
+
|
659
|
+
it "top-level-it" do end
|
660
|
+
|
661
|
+
z = describe "second thingy" do end
|
662
|
+
end
|
663
|
+
|
664
|
+
assert_equal [x], Minitest::Spec.children
|
665
|
+
assert_equal [y, z], x.children
|
666
|
+
assert_equal [], y.children
|
667
|
+
assert_equal [], z.children
|
668
|
+
end
|
669
|
+
|
670
|
+
def test_it_wont_remove_existing_child_test_methods
|
671
|
+
Minitest::Spec.children.clear # prevents parallel run
|
672
|
+
|
673
|
+
inner = nil
|
674
|
+
outer = describe "outer" do
|
675
|
+
inner = describe "inner" do
|
676
|
+
it do
|
677
|
+
assert true
|
678
|
+
end
|
679
|
+
end
|
680
|
+
it do
|
681
|
+
assert true
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
assert_equal 1, outer.public_instance_methods.grep(/^test_/).count
|
686
|
+
assert_equal 1, inner.public_instance_methods.grep(/^test_/).count
|
687
|
+
end
|
688
|
+
|
689
|
+
def test_it_wont_add_test_methods_to_children
|
690
|
+
Minitest::Spec.children.clear # prevents parallel run
|
691
|
+
|
692
|
+
inner = nil
|
693
|
+
outer = describe "outer" do
|
694
|
+
inner = describe "inner" do end
|
695
|
+
it do
|
696
|
+
assert true
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
assert_equal 1, outer.public_instance_methods.grep(/^test_/).count
|
701
|
+
assert_equal 0, inner.public_instance_methods.grep(/^test_/).count
|
702
|
+
end
|
703
|
+
end
|
704
|
+
|
705
|
+
require "minitest/metametameta"
|
706
|
+
|
707
|
+
class TestMeta < MetaMetaMetaTestCase
|
708
|
+
parallelize_me!
|
709
|
+
|
710
|
+
def util_structure
|
711
|
+
y = z = nil
|
712
|
+
before_list = []
|
713
|
+
after_list = []
|
714
|
+
x = describe "top-level thingy" do
|
715
|
+
before { before_list << 1 }
|
716
|
+
after { after_list << 1 }
|
717
|
+
|
718
|
+
it "top-level-it" do end
|
719
|
+
|
720
|
+
y = describe "inner thingy" do
|
721
|
+
before { before_list << 2 }
|
722
|
+
after { after_list << 2 }
|
723
|
+
it "inner-it" do end
|
724
|
+
|
725
|
+
z = describe "very inner thingy" do
|
726
|
+
before { before_list << 3 }
|
727
|
+
after { after_list << 3 }
|
728
|
+
it "inner-it" do end
|
729
|
+
|
730
|
+
it { } # ignore me
|
731
|
+
specify { } # anonymous it
|
732
|
+
end
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
736
|
+
return x, y, z, before_list, after_list
|
737
|
+
end
|
738
|
+
|
739
|
+
def test_register_spec_type
|
740
|
+
original_types = Minitest::Spec::TYPES.dup
|
741
|
+
|
742
|
+
assert_includes Minitest::Spec::TYPES, [//, Minitest::Spec]
|
743
|
+
|
744
|
+
Minitest::Spec.register_spec_type(/woot/, TestMeta)
|
745
|
+
|
746
|
+
p = lambda do |_| true end
|
747
|
+
Minitest::Spec.register_spec_type TestMeta, &p
|
748
|
+
|
749
|
+
keys = Minitest::Spec::TYPES.map(&:first)
|
750
|
+
|
751
|
+
assert_includes keys, /woot/
|
752
|
+
assert_includes keys, p
|
753
|
+
ensure
|
754
|
+
Minitest::Spec::TYPES.replace original_types
|
755
|
+
end
|
756
|
+
|
757
|
+
def test_spec_type
|
758
|
+
original_types = Minitest::Spec::TYPES.dup
|
759
|
+
|
760
|
+
Minitest::Spec.register_spec_type(/A$/, MiniSpecA)
|
761
|
+
Minitest::Spec.register_spec_type MiniSpecB do |desc|
|
762
|
+
desc.superclass == ExampleA
|
763
|
+
end
|
764
|
+
Minitest::Spec.register_spec_type MiniSpecC do |_desc, *addl|
|
765
|
+
addl.include? :woot
|
766
|
+
end
|
767
|
+
|
768
|
+
assert_equal MiniSpecA, Minitest::Spec.spec_type(ExampleA)
|
769
|
+
assert_equal MiniSpecB, Minitest::Spec.spec_type(ExampleB)
|
770
|
+
assert_equal MiniSpecC, Minitest::Spec.spec_type(ExampleB, :woot)
|
771
|
+
ensure
|
772
|
+
Minitest::Spec::TYPES.replace original_types
|
773
|
+
end
|
774
|
+
|
775
|
+
def test_bug_dsl_expectations
|
776
|
+
spec_class = Class.new MiniSpecB do
|
777
|
+
it "should work" do
|
778
|
+
0.must_equal 0
|
779
|
+
end
|
780
|
+
end
|
781
|
+
|
782
|
+
test_name = spec_class.instance_methods.sort.grep(/test/).first
|
783
|
+
|
784
|
+
spec = spec_class.new test_name
|
785
|
+
|
786
|
+
result = spec.run
|
787
|
+
|
788
|
+
assert spec.passed?
|
789
|
+
assert result.passed?
|
790
|
+
assert_equal 1, result.assertions
|
791
|
+
end
|
792
|
+
|
793
|
+
def test_name
|
794
|
+
spec_a = describe ExampleA do; end
|
795
|
+
spec_b = describe ExampleB, :random_method do; end
|
796
|
+
spec_c = describe ExampleB, :random_method, :addl_context do; end
|
797
|
+
|
798
|
+
assert_equal "ExampleA", spec_a.name
|
799
|
+
assert_equal "ExampleB::random_method", spec_b.name
|
800
|
+
assert_equal "ExampleB::random_method::addl_context", spec_c.name
|
801
|
+
end
|
802
|
+
|
803
|
+
def test_name2
|
804
|
+
assert_equal "NamedExampleA", NamedExampleA.name
|
805
|
+
assert_equal "NamedExampleB", NamedExampleB.name
|
806
|
+
assert_equal "NamedExampleC", NamedExampleC.name
|
807
|
+
|
808
|
+
spec_a = describe ExampleA do; end
|
809
|
+
spec_b = describe ExampleB, :random_method do; end
|
810
|
+
|
811
|
+
assert_equal "ExampleA", spec_a.name
|
812
|
+
assert_equal "ExampleB::random_method", spec_b.name
|
813
|
+
end
|
814
|
+
|
815
|
+
def test_structure
|
816
|
+
x, y, z, * = util_structure
|
817
|
+
|
818
|
+
assert_equal "top-level thingy", x.to_s
|
819
|
+
assert_equal "top-level thingy::inner thingy", y.to_s
|
820
|
+
assert_equal "top-level thingy::inner thingy::very inner thingy", z.to_s
|
821
|
+
|
822
|
+
assert_equal "top-level thingy", x.desc
|
823
|
+
assert_equal "inner thingy", y.desc
|
824
|
+
assert_equal "very inner thingy", z.desc
|
825
|
+
|
826
|
+
top_methods = %w[setup teardown test_0001_top-level-it]
|
827
|
+
inner_methods1 = %w[setup teardown test_0001_inner-it]
|
828
|
+
inner_methods2 = inner_methods1 +
|
829
|
+
%w[test_0002_anonymous test_0003_anonymous]
|
830
|
+
|
831
|
+
assert_equal top_methods, x.instance_methods(false).sort.map(&:to_s)
|
832
|
+
assert_equal inner_methods1, y.instance_methods(false).sort.map(&:to_s)
|
833
|
+
assert_equal inner_methods2, z.instance_methods(false).sort.map(&:to_s)
|
834
|
+
end
|
835
|
+
|
836
|
+
def test_structure_postfix_it
|
837
|
+
z = nil
|
838
|
+
y = describe "outer" do
|
839
|
+
# NOT here, below the inner-describe!
|
840
|
+
# it "inner-it" do end
|
841
|
+
|
842
|
+
z = describe "inner" do
|
843
|
+
it "inner-it" do end
|
844
|
+
end
|
845
|
+
|
846
|
+
# defined AFTER inner describe means we'll try to wipe out the inner-it
|
847
|
+
it "inner-it" do end
|
848
|
+
end
|
849
|
+
|
850
|
+
assert_equal %w[test_0001_inner-it], y.instance_methods(false).map(&:to_s)
|
851
|
+
assert_equal %w[test_0001_inner-it], z.instance_methods(false).map(&:to_s)
|
852
|
+
end
|
853
|
+
|
854
|
+
def test_setup_teardown_behavior
|
855
|
+
_, _, z, before_list, after_list = util_structure
|
856
|
+
|
857
|
+
@tu = z
|
858
|
+
|
859
|
+
run_tu_with_fresh_reporter
|
860
|
+
|
861
|
+
size = z.runnable_methods.size
|
862
|
+
assert_equal [1, 2, 3] * size, before_list
|
863
|
+
assert_equal [3, 2, 1] * size, after_list
|
864
|
+
end
|
865
|
+
|
866
|
+
def test_describe_first_structure
|
867
|
+
x1 = x2 = y = z = nil
|
868
|
+
x = describe "top-level thingy" do
|
869
|
+
y = describe "first thingy" do end
|
870
|
+
|
871
|
+
x1 = it "top level it" do end
|
872
|
+
x2 = it "не латинские &いった α, β, γ, δ, ε hello!!! world" do end
|
873
|
+
|
874
|
+
z = describe "second thingy" do end
|
875
|
+
end
|
876
|
+
|
877
|
+
test_methods = ["test_0001_top level it",
|
878
|
+
"test_0002_не латинские &いった α, β, γ, δ, ε hello!!! world",
|
879
|
+
].sort
|
880
|
+
|
881
|
+
assert_equal test_methods, [x1, x2]
|
882
|
+
assert_equal test_methods, x.instance_methods.grep(/^test/).map(&:to_s).sort
|
883
|
+
assert_equal [], y.instance_methods.grep(/^test/)
|
884
|
+
assert_equal [], z.instance_methods.grep(/^test/)
|
885
|
+
end
|
886
|
+
|
887
|
+
def test_structure_subclasses
|
888
|
+
z = nil
|
889
|
+
x = Class.new Minitest::Spec do
|
890
|
+
def xyz; end
|
891
|
+
end
|
892
|
+
y = Class.new x do
|
893
|
+
z = describe("inner") { }
|
894
|
+
end
|
895
|
+
|
896
|
+
assert_respond_to x.new(nil), "xyz"
|
897
|
+
assert_respond_to y.new(nil), "xyz"
|
898
|
+
assert_respond_to z.new(nil), "xyz"
|
899
|
+
end
|
900
|
+
end
|
901
|
+
|
902
|
+
class TestSpecInTestCase < MetaMetaMetaTestCase
|
903
|
+
def setup
|
904
|
+
super
|
905
|
+
|
906
|
+
Thread.current[:current_spec] = self
|
907
|
+
@tc = self
|
908
|
+
@assertion_count = 2
|
909
|
+
end
|
910
|
+
|
911
|
+
def assert_triggered expected, klass = Minitest::Assertion
|
912
|
+
@assertion_count += 1
|
913
|
+
|
914
|
+
e = assert_raises klass do
|
915
|
+
yield
|
916
|
+
end
|
917
|
+
|
918
|
+
msg = e.message.sub(/(---Backtrace---).*/m, "\1")
|
919
|
+
msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")
|
920
|
+
|
921
|
+
assert_equal expected, msg
|
922
|
+
end
|
923
|
+
|
924
|
+
def teardown
|
925
|
+
msg = "expected #{@assertion_count} assertions, not #{@tc.assertions}"
|
926
|
+
assert_equal @assertion_count, @tc.assertions, msg
|
927
|
+
end
|
928
|
+
|
929
|
+
def test_expectation
|
930
|
+
@tc.assert_equal true, 1.must_equal(1)
|
931
|
+
end
|
932
|
+
|
933
|
+
def test_expectation_triggered
|
934
|
+
assert_triggered "Expected: 2\n Actual: 1" do
|
935
|
+
1.must_equal 2
|
936
|
+
end
|
937
|
+
end
|
938
|
+
|
939
|
+
def test_expectation_with_a_message
|
940
|
+
assert_triggered "woot.\nExpected: 2\n Actual: 1" do
|
941
|
+
1.must_equal 2, "woot"
|
942
|
+
end
|
943
|
+
end
|
944
|
+
end
|
945
|
+
|
946
|
+
class ValueMonadTest < Minitest::Test
|
947
|
+
attr_accessor :struct
|
948
|
+
|
949
|
+
def setup
|
950
|
+
@struct = { :_ => 'a', :value => 'b', :expect => 'c' }
|
951
|
+
def @struct.method_missing k # think openstruct
|
952
|
+
self[k]
|
953
|
+
end
|
954
|
+
end
|
955
|
+
|
956
|
+
def test_value_monad_method
|
957
|
+
assert_equal 'a', struct._
|
958
|
+
end
|
959
|
+
|
960
|
+
def test_value_monad_value_alias
|
961
|
+
assert_equal 'b', struct.value
|
962
|
+
end
|
963
|
+
|
964
|
+
def test_value_monad_expect_alias
|
965
|
+
assert_equal 'c', struct.expect
|
966
|
+
end
|
967
|
+
end
|