genkaio 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundle/config +2 -0
- data/.gitignore +2 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +34 -0
- data/LICENSE.txt +21 -0
- data/README.md +78 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/genkaio +66 -0
- data/bin/setup +8 -0
- data/demo.gif +0 -0
- data/genkaio.gemspec +28 -0
- data/lib/.genkaio.rb.swp +0 -0
- data/lib/dic/dicdata_2019_1108 +212408 -0
- data/lib/genkaio/version.rb +3 -0
- data/lib/genkaio.rb +73 -0
- data/pkg/genkaio-0.0.1.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/bin/genkaio +27 -0
- data/vendor/bundle/ruby/2.5.0/bin/htmldiff +29 -0
- data/vendor/bundle/ruby/2.5.0/bin/ldiff +29 -0
- data/vendor/bundle/ruby/2.5.0/bin/rake +27 -0
- data/vendor/bundle/ruby/2.5.0/bin/rspec +27 -0
- data/vendor/bundle/ruby/2.5.0/cache/diff-lcs-1.3.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/cache/rake-12.3.3.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/cache/rspec-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/cache/rspec-core-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/cache/rspec-expectations-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/cache/rspec-mocks-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/cache/rspec-support-3.9.0.gem +0 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/.rspec +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/Code-of-Conduct.md +74 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/Contributing.md +83 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/History.md +220 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/License.md +39 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/Manifest.txt +37 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/README.rdoc +84 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/Rakefile +57 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/autotest/discover.rb +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/bin/htmldiff +32 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/bin/ldiff +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/docs/COPYING.txt +339 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/docs/artistic.txt +127 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/array.rb +7 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/block.rb +37 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/callbacks.rb +322 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/change.rb +181 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/htmldiff.rb +149 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/hunk.rb +276 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/internals.rb +307 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/ldiff.rb +167 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs/string.rb +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff/lcs.rb +725 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/lib/diff-lcs.rb +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/change_spec.rb +65 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/diff_spec.rb +47 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/fixtures/ds1.csv +50 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/fixtures/ds2.csv +51 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/hunk_spec.rb +72 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/issues_spec.rb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/lcs_spec.rb +56 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/ldiff_spec.rb +47 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/patch_spec.rb +422 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/sdiff_spec.rb +214 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/spec_helper.rb +321 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/traverse_balanced_spec.rb +310 -0
- data/vendor/bundle/ruby/2.5.0/gems/diff-lcs-1.3/spec/traverse_sequences_spec.rb +139 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/CONTRIBUTING.rdoc +43 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/Gemfile +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/History.rdoc +2344 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/README.rdoc +156 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/Rakefile +41 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/azure-pipelines.yml +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/bin/bundle +105 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/bin/console +7 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/bin/rake +29 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/bin/rdoc +29 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/bin/rubocop +29 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/bin/setup +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/jamis.rb +592 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/rake.1 +156 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/rakefile.rdoc +622 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/exe/rake +27 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/application.rb +824 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/backtrace.rb +24 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/clean.rb +78 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/cloneable.rb +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/cpu_counter.rb +107 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/default_loader.rb +15 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/dsl_definition.rb +195 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/early_time.rb +22 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/ext/core.rb +26 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/ext/string.rb +176 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/file_creation_task.rb +25 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/file_list.rb +435 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/file_task.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/file_utils.rb +137 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/file_utils_ext.rb +145 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/invocation_chain.rb +57 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/invocation_exception_mixin.rb +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/late_time.rb +18 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/linked_list.rb +112 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/loaders/makefile.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/multi_task.rb +14 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/packagetask.rb +207 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/phony.rb +16 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/private_reader.rb +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/promise.rb +100 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/pseudo_status.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/rake_module.rb +67 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/rake_test_loader.rb +27 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/scope.rb +43 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/task.rb +413 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/task_argument_error.rb +8 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/task_arguments.rb +109 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/task_manager.rb +324 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/tasklib.rb +12 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/testtask.rb +224 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/thread_history_display.rb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/thread_pool.rb +163 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/trace_output.rb +23 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/version.rb +10 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake/win32.rb +51 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/lib/rake.rb +71 -0
- data/vendor/bundle/ruby/2.5.0/gems/rake-12.3.3/rake.gemspec +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-3.9.0/LICENSE.md +27 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-3.9.0/README.md +43 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-3.9.0/lib/rspec/version.rb +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-3.9.0/lib/rspec.rb +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/.document +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/.yardopts +8 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/Changelog.md +2265 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/LICENSE.md +26 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/README.md +384 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/exe/rspec +4 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/autorun.rb +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/backtrace_formatter.rb +65 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/coordinator.rb +62 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/example_minimizer.rb +173 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/fork_runner.rb +134 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/server.rb +61 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/shell_command.rb +126 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/shell_runner.rb +73 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/bisect/utilities.rb +58 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/configuration.rb +2336 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/configuration_options.rb +233 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/did_you_mean.rb +46 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/drb.rb +113 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/dsl.rb +98 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/example.rb +656 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/example_group.rb +889 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/example_status_persister.rb +235 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/filter_manager.rb +231 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/flat_map.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/base_formatter.rb +70 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/base_text_formatter.rb +75 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/bisect_progress_formatter.rb +157 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/console_codes.rb +68 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/documentation_formatter.rb +102 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/exception_presenter.rb +508 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/helpers.rb +110 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/html_formatter.rb +153 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/html_printer.rb +414 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/html_snippet_extractor.rb +120 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/json_formatter.rb +102 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/profile_formatter.rb +68 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/progress_formatter.rb +29 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/protocol.rb +182 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/snippet_extractor.rb +134 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters/syntax_highlighter.rb +91 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/formatters.rb +272 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/hooks.rb +632 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/invocations.rb +87 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/memoized_helpers.rb +554 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/metadata.rb +498 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/metadata_filter.rb +255 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/null.rb +14 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/rr.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/notifications.rb +521 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/option_parser.rb +317 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/ordering.rb +158 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/output_wrapper.rb +29 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/pending.rb +165 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/profiler.rb +34 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/project_initializer/.rspec +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/project_initializer/spec/spec_helper.rb +100 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/project_initializer.rb +48 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/rake_task.rb +188 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/reporter.rb +265 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/ruby_project.rb +53 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/runner.rb +204 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/sandbox.rb +37 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/set.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/shared_context.rb +55 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/shared_example_group.rb +269 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/shell_escape.rb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/version.rb +9 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/warnings.rb +40 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core/world.rb +275 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-core-3.9.0/lib/rspec/core.rb +186 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/.document +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/.yardopts +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/Changelog.md +1170 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/LICENSE.md +25 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/README.md +320 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/block_snippet_extractor.rb +253 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/configuration.rb +215 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/expectation_target.rb +127 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/fail_with.rb +39 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/failure_aggregator.rb +194 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/handler.rb +170 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/minitest_integration.rb +58 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/syntax.rb +132 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations/version.rb +8 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/expectations.rb +82 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/aliased_matcher.rb +116 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/all.rb +86 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/base_matcher.rb +193 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be.rb +288 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_between.rb +77 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_instance_of.rb +26 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_kind_of.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/be_within.rb +72 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/change.rb +428 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/compound.rb +276 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/contain_exactly.rb +302 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/cover.rb +24 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/eq.rb +40 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/eql.rb +34 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/equal.rb +81 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/exist.rb +90 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/has.rb +103 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/include.rb +149 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/match.rb +106 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/operators.rb +128 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/output.rb +200 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/raise_error.rb +230 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/respond_to.rb +174 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/satisfy.rb +60 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in/yield.rb +432 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/built_in.rb +52 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/composable.rb +171 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/dsl.rb +534 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/english_phrasing.rb +58 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +82 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/fail_matchers.rb +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/generated_descriptions.rb +41 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/matcher_delegator.rb +35 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/matcher_protocol.rb +99 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers.rb +1038 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/.document +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/.yardopts +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/Changelog.md +1125 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/LICENSE.md +25 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/README.md +463 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/chain.rb +111 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/expect_chain_chain.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/expectation_chain.rb +50 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/proxy.rb +116 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/recorder.rb +289 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/stub_chain.rb +51 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance/stub_chain_chain.rb +23 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/any_instance.rb +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/argument_list_matcher.rb +100 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/argument_matchers.rb +322 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/configuration.rb +212 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/error_generator.rb +369 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/example_methods.rb +434 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/instance_method_stasher.rb +146 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/marshal_extension.rb +41 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/have_received.rb +134 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/receive.rb +132 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/receive_message_chain.rb +82 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/matchers/receive_messages.rb +77 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/message_chain.rb +87 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/message_expectation.rb +751 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/method_double.rb +287 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/method_reference.rb +202 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/minitest_integration.rb +68 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/mutate_const.rb +339 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/object_reference.rb +149 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/order_group.rb +81 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/proxy.rb +503 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/space.rb +238 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/standalone.rb +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/syntax.rb +325 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/targets.rb +124 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/test_double.rb +171 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/verifying_double.rb +129 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/verifying_message_expectation.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/verifying_proxy.rb +220 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks/version.rb +9 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-mocks-3.9.0/lib/rspec/mocks.rb +130 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/Changelog.md +275 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/LICENSE.md +23 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/README.md +40 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/caller_filter.rb +83 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/comparable_version.rb +46 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/differ.rb +215 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/directory_maker.rb +63 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/encoded_string.rb +165 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/hunk_generator.rb +47 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/matcher_definition.rb +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/method_signature_verifier.rb +438 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/mutex.rb +73 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/object_formatter.rb +275 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/recursive_const_methods.rb +76 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/reentrant_mutex.rb +53 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/ruby_features.rb +176 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/source/location.rb +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/source/node.rb +110 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/source/token.rb +87 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/source.rb +75 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/formatting_support.rb +9 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/in_sub_process.rb +69 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/library_wide_checks.rb +150 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/shell_out.rb +89 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/string_matcher.rb +46 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/with_isolated_directory.rb +13 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/spec.rb +81 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/version.rb +7 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support/warnings.rb +39 -0
- data/vendor/bundle/ruby/2.5.0/gems/rspec-support-3.9.0/lib/rspec/support.rb +149 -0
- data/vendor/bundle/ruby/2.5.0/specifications/diff-lcs-1.3.gemspec +61 -0
- data/vendor/bundle/ruby/2.5.0/specifications/rake-12.3.3.gemspec +49 -0
- data/vendor/bundle/ruby/2.5.0/specifications/rspec-3.9.0.gemspec +43 -0
- data/vendor/bundle/ruby/2.5.0/specifications/rspec-core-3.9.0.gemspec +63 -0
- data/vendor/bundle/ruby/2.5.0/specifications/rspec-expectations-3.9.0.gemspec +51 -0
- data/vendor/bundle/ruby/2.5.0/specifications/rspec-mocks-3.9.0.gemspec +51 -0
- data/vendor/bundle/ruby/2.5.0/specifications/rspec-support-3.9.0.gemspec +39 -0
- metadata +411 -0
@@ -0,0 +1,534 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Matchers
|
3
|
+
# Defines the custom matcher DSL.
|
4
|
+
module DSL
|
5
|
+
# Defines a matcher alias. The returned matcher's `description` will be overriden
|
6
|
+
# to reflect the phrasing of the new name, which will be used in failure messages
|
7
|
+
# when passed as an argument to another matcher in a composed matcher expression.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# RSpec::Matchers.alias_matcher :a_list_that_sums_to, :sum_to
|
11
|
+
# sum_to(3).description # => "sum to 3"
|
12
|
+
# a_list_that_sums_to(3).description # => "a list that sums to 3"
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# RSpec::Matchers.alias_matcher :a_list_sorted_by, :be_sorted_by do |description|
|
16
|
+
# description.sub("be sorted by", "a list sorted by")
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# be_sorted_by(:age).description # => "be sorted by age"
|
20
|
+
# a_list_sorted_by(:age).description # => "a list sorted by age"
|
21
|
+
#
|
22
|
+
# @param new_name [Symbol] the new name for the matcher
|
23
|
+
# @param old_name [Symbol] the original name for the matcher
|
24
|
+
# @param options [Hash] options for the aliased matcher
|
25
|
+
# @option options [Class] :klass the ruby class to use as the decorator. (Not normally used).
|
26
|
+
# @yield [String] optional block that, when given, is used to define the overriden
|
27
|
+
# logic. The yielded arg is the original description or failure message. If no
|
28
|
+
# block is provided, a default override is used based on the old and new names.
|
29
|
+
# @see RSpec::Matchers
|
30
|
+
def alias_matcher(new_name, old_name, options={}, &description_override)
|
31
|
+
description_override ||= lambda do |old_desc|
|
32
|
+
old_desc.gsub(EnglishPhrasing.split_words(old_name), EnglishPhrasing.split_words(new_name))
|
33
|
+
end
|
34
|
+
klass = options.fetch(:klass) { AliasedMatcher }
|
35
|
+
|
36
|
+
define_method(new_name) do |*args, &block|
|
37
|
+
matcher = __send__(old_name, *args, &block)
|
38
|
+
matcher.matcher_name = new_name if matcher.respond_to?(:matcher_name=)
|
39
|
+
klass.new(matcher, description_override)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Defines a negated matcher. The returned matcher's `description` and `failure_message`
|
44
|
+
# will be overriden to reflect the phrasing of the new name, and the match logic will
|
45
|
+
# be based on the original matcher but negated.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# RSpec::Matchers.define_negated_matcher :exclude, :include
|
49
|
+
# include(1, 2).description # => "include 1 and 2"
|
50
|
+
# exclude(1, 2).description # => "exclude 1 and 2"
|
51
|
+
#
|
52
|
+
# @param negated_name [Symbol] the name for the negated matcher
|
53
|
+
# @param base_name [Symbol] the name of the original matcher that will be negated
|
54
|
+
# @yield [String] optional block that, when given, is used to define the overriden
|
55
|
+
# logic. The yielded arg is the original description or failure message. If no
|
56
|
+
# block is provided, a default override is used based on the old and new names.
|
57
|
+
# @see RSpec::Matchers
|
58
|
+
def define_negated_matcher(negated_name, base_name, &description_override)
|
59
|
+
alias_matcher(negated_name, base_name, :klass => AliasedNegatedMatcher, &description_override)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Defines a custom matcher.
|
63
|
+
#
|
64
|
+
# @param name [Symbol] the name for the matcher
|
65
|
+
# @yield [Object] block that is used to define the matcher.
|
66
|
+
# The block is evaluated in the context of your custom matcher class.
|
67
|
+
# When args are passed to your matcher, they will be yielded here,
|
68
|
+
# usually representing the expected value(s).
|
69
|
+
# @see RSpec::Matchers
|
70
|
+
def define(name, &declarations)
|
71
|
+
warn_about_block_args(name, declarations)
|
72
|
+
define_method name do |*expected, &block_arg|
|
73
|
+
RSpec::Matchers::DSL::Matcher.new(name, declarations, self, *expected, &block_arg)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
alias_method :matcher, :define
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
if Proc.method_defined?(:parameters)
|
81
|
+
def warn_about_block_args(name, declarations)
|
82
|
+
declarations.parameters.each do |type, arg_name|
|
83
|
+
next unless type == :block
|
84
|
+
RSpec.warning("Your `#{name}` custom matcher receives a block argument (`#{arg_name}`), " \
|
85
|
+
"but due to limitations in ruby, RSpec cannot provide the block. Instead, " \
|
86
|
+
"use the `block_arg` method to access the block")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
else
|
90
|
+
# :nocov:
|
91
|
+
def warn_about_block_args(*)
|
92
|
+
# There's no way to detect block params on 1.8 since the method reflection APIs don't expose it
|
93
|
+
end
|
94
|
+
# :nocov:
|
95
|
+
end
|
96
|
+
|
97
|
+
RSpec.configure { |c| c.extend self } if RSpec.respond_to?(:configure)
|
98
|
+
|
99
|
+
# Contains the methods that are available from within the
|
100
|
+
# `RSpec::Matchers.define` DSL for creating custom matchers.
|
101
|
+
module Macros
|
102
|
+
# Stores the block that is used to determine whether this matcher passes
|
103
|
+
# or fails. The block should return a boolean value. When the matcher is
|
104
|
+
# passed to `expect(...).to` and the block returns `true`, then the expectation
|
105
|
+
# passes. Similarly, when the matcher is passed to `expect(...).not_to` and the
|
106
|
+
# block returns `false`, then the expectation passes.
|
107
|
+
#
|
108
|
+
# @example
|
109
|
+
#
|
110
|
+
# RSpec::Matchers.define :be_even do
|
111
|
+
# match do |actual|
|
112
|
+
# actual.even?
|
113
|
+
# end
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# expect(4).to be_even # passes
|
117
|
+
# expect(3).not_to be_even # passes
|
118
|
+
# expect(3).to be_even # fails
|
119
|
+
# expect(4).not_to be_even # fails
|
120
|
+
#
|
121
|
+
# By default the match block will swallow expectation errors (e.g.
|
122
|
+
# caused by using an expectation such as `expect(1).to eq 2`), if you
|
123
|
+
# with to allow these to bubble up, pass in the option
|
124
|
+
# `:notify_expectation_failures => true`.
|
125
|
+
#
|
126
|
+
# @param [Hash] options for defining the behavior of the match block.
|
127
|
+
# @yield [Object] actual the actual value (i.e. the value wrapped by `expect`)
|
128
|
+
def match(options={}, &match_block)
|
129
|
+
define_user_override(:matches?, match_block) do |actual|
|
130
|
+
@actual = actual
|
131
|
+
RSpec::Support.with_failure_notifier(RAISE_NOTIFIER) do
|
132
|
+
begin
|
133
|
+
super(*actual_arg_for(match_block))
|
134
|
+
rescue RSpec::Expectations::ExpectationNotMetError
|
135
|
+
raise if options[:notify_expectation_failures]
|
136
|
+
false
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# @private
|
143
|
+
RAISE_NOTIFIER = Proc.new { |err, _opts| raise err }
|
144
|
+
|
145
|
+
# Use this to define the block for a negative expectation (`expect(...).not_to`)
|
146
|
+
# when the positive and negative forms require different handling. This
|
147
|
+
# is rarely necessary, but can be helpful, for example, when specifying
|
148
|
+
# asynchronous processes that require different timeouts.
|
149
|
+
#
|
150
|
+
# By default the match block will swallow expectation errors (e.g.
|
151
|
+
# caused by using an expectation such as `expect(1).to eq 2`), if you
|
152
|
+
# with to allow these to bubble up, pass in the option
|
153
|
+
# `:notify_expectation_failures => true`.
|
154
|
+
#
|
155
|
+
# @param [Hash] options for defining the behavior of the match block.
|
156
|
+
# @yield [Object] actual the actual value (i.e. the value wrapped by `expect`)
|
157
|
+
def match_when_negated(options={}, &match_block)
|
158
|
+
define_user_override(:does_not_match?, match_block) do |actual|
|
159
|
+
begin
|
160
|
+
@actual = actual
|
161
|
+
RSpec::Support.with_failure_notifier(RAISE_NOTIFIER) do
|
162
|
+
super(*actual_arg_for(match_block))
|
163
|
+
end
|
164
|
+
rescue RSpec::Expectations::ExpectationNotMetError
|
165
|
+
raise if options[:notify_expectation_failures]
|
166
|
+
false
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Use this instead of `match` when the block will raise an exception
|
172
|
+
# rather than returning false to indicate a failure.
|
173
|
+
#
|
174
|
+
# @example
|
175
|
+
#
|
176
|
+
# RSpec::Matchers.define :accept_as_valid do |candidate_address|
|
177
|
+
# match_unless_raises ValidationException do |validator|
|
178
|
+
# validator.validate(candidate_address)
|
179
|
+
# end
|
180
|
+
# end
|
181
|
+
#
|
182
|
+
# expect(email_validator).to accept_as_valid("person@company.com")
|
183
|
+
#
|
184
|
+
# @yield [Object] actual the actual object (i.e. the value wrapped by `expect`)
|
185
|
+
def match_unless_raises(expected_exception=Exception, &match_block)
|
186
|
+
define_user_override(:matches?, match_block) do |actual|
|
187
|
+
@actual = actual
|
188
|
+
begin
|
189
|
+
super(*actual_arg_for(match_block))
|
190
|
+
rescue expected_exception => @rescued_exception
|
191
|
+
false
|
192
|
+
else
|
193
|
+
true
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
# Customizes the failure messsage to use when this matcher is
|
199
|
+
# asked to positively match. Only use this when the message
|
200
|
+
# generated by default doesn't suit your needs.
|
201
|
+
#
|
202
|
+
# @example
|
203
|
+
#
|
204
|
+
# RSpec::Matchers.define :have_strength do |expected|
|
205
|
+
# match { your_match_logic }
|
206
|
+
#
|
207
|
+
# failure_message do |actual|
|
208
|
+
# "Expected strength of #{expected}, but had #{actual.strength}"
|
209
|
+
# end
|
210
|
+
# end
|
211
|
+
#
|
212
|
+
# @yield [Object] actual the actual object (i.e. the value wrapped by `expect`)
|
213
|
+
def failure_message(&definition)
|
214
|
+
define_user_override(__method__, definition)
|
215
|
+
end
|
216
|
+
|
217
|
+
# Customize the failure messsage to use when this matcher is asked
|
218
|
+
# to negatively match. Only use this when the message generated by
|
219
|
+
# default doesn't suit your needs.
|
220
|
+
#
|
221
|
+
# @example
|
222
|
+
#
|
223
|
+
# RSpec::Matchers.define :have_strength do |expected|
|
224
|
+
# match { your_match_logic }
|
225
|
+
#
|
226
|
+
# failure_message_when_negated do |actual|
|
227
|
+
# "Expected not to have strength of #{expected}, but did"
|
228
|
+
# end
|
229
|
+
# end
|
230
|
+
#
|
231
|
+
# @yield [Object] actual the actual object (i.e. the value wrapped by `expect`)
|
232
|
+
def failure_message_when_negated(&definition)
|
233
|
+
define_user_override(__method__, definition)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Customize the description to use for one-liners. Only use this when
|
237
|
+
# the description generated by default doesn't suit your needs.
|
238
|
+
#
|
239
|
+
# @example
|
240
|
+
#
|
241
|
+
# RSpec::Matchers.define :qualify_for do |expected|
|
242
|
+
# match { your_match_logic }
|
243
|
+
#
|
244
|
+
# description do
|
245
|
+
# "qualify for #{expected}"
|
246
|
+
# end
|
247
|
+
# end
|
248
|
+
#
|
249
|
+
# @yield [Object] actual the actual object (i.e. the value wrapped by `expect`)
|
250
|
+
def description(&definition)
|
251
|
+
define_user_override(__method__, definition)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Tells the matcher to diff the actual and expected values in the failure
|
255
|
+
# message.
|
256
|
+
def diffable
|
257
|
+
define_method(:diffable?) { true }
|
258
|
+
end
|
259
|
+
|
260
|
+
# Declares that the matcher can be used in a block expectation.
|
261
|
+
# Users will not be able to use your matcher in a block
|
262
|
+
# expectation without declaring this.
|
263
|
+
# (e.g. `expect { do_something }.to matcher`).
|
264
|
+
def supports_block_expectations
|
265
|
+
define_method(:supports_block_expectations?) { true }
|
266
|
+
end
|
267
|
+
|
268
|
+
# Convenience for defining methods on this matcher to create a fluent
|
269
|
+
# interface. The trick about fluent interfaces is that each method must
|
270
|
+
# return self in order to chain methods together. `chain` handles that
|
271
|
+
# for you. If the method is invoked and the
|
272
|
+
# `include_chain_clauses_in_custom_matcher_descriptions` config option
|
273
|
+
# hash been enabled, the chained method name and args will be added to the
|
274
|
+
# default description and failure message.
|
275
|
+
#
|
276
|
+
# In the common case where you just want the chained method to store some
|
277
|
+
# value(s) for later use (e.g. in `match`), you can provide one or more
|
278
|
+
# attribute names instead of a block; the chained method will store its
|
279
|
+
# arguments in instance variables with those names, and the values will
|
280
|
+
# be exposed via getters.
|
281
|
+
#
|
282
|
+
# @example
|
283
|
+
#
|
284
|
+
# RSpec::Matchers.define :have_errors_on do |key|
|
285
|
+
# chain :with do |message|
|
286
|
+
# @message = message
|
287
|
+
# end
|
288
|
+
#
|
289
|
+
# match do |actual|
|
290
|
+
# actual.errors[key] == @message
|
291
|
+
# end
|
292
|
+
# end
|
293
|
+
#
|
294
|
+
# expect(minor).to have_errors_on(:age).with("Not old enough to participate")
|
295
|
+
def chain(method_name, *attr_names, &definition)
|
296
|
+
unless block_given? ^ attr_names.any?
|
297
|
+
raise ArgumentError, "You must pass either a block or some attribute names (but not both) to `chain`."
|
298
|
+
end
|
299
|
+
|
300
|
+
definition = assign_attributes(attr_names) if attr_names.any?
|
301
|
+
|
302
|
+
define_user_override(method_name, definition) do |*args, &block|
|
303
|
+
super(*args, &block)
|
304
|
+
@chained_method_clauses.push([method_name, args])
|
305
|
+
self
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
def assign_attributes(attr_names)
|
310
|
+
attr_reader(*attr_names)
|
311
|
+
private(*attr_names)
|
312
|
+
|
313
|
+
lambda do |*attr_values|
|
314
|
+
attr_names.zip(attr_values) do |attr_name, attr_value|
|
315
|
+
instance_variable_set(:"@#{attr_name}", attr_value)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
# assign_attributes isn't defined in the private section below because
|
321
|
+
# that makes MRI 1.9.2 emit a warning about private attributes.
|
322
|
+
private :assign_attributes
|
323
|
+
|
324
|
+
private
|
325
|
+
|
326
|
+
# Does the following:
|
327
|
+
#
|
328
|
+
# - Defines the named method using a user-provided block
|
329
|
+
# in @user_method_defs, which is included as an ancestor
|
330
|
+
# in the singleton class in which we eval the `define` block.
|
331
|
+
# - Defines an overriden definition for the same method
|
332
|
+
# usign the provided `our_def` block.
|
333
|
+
# - Provides a default `our_def` block for the common case
|
334
|
+
# of needing to call the user's definition with `@actual`
|
335
|
+
# as an arg, but only if their block's arity can handle it.
|
336
|
+
#
|
337
|
+
# This compiles the user block into an actual method, allowing
|
338
|
+
# them to use normal method constructs like `return`
|
339
|
+
# (e.g. for an early guard statement), while allowing us to define
|
340
|
+
# an override that can provide the wrapped handling
|
341
|
+
# (e.g. assigning `@actual`, rescueing errors, etc) and
|
342
|
+
# can `super` to the user's definition.
|
343
|
+
def define_user_override(method_name, user_def, &our_def)
|
344
|
+
@user_method_defs.__send__(:define_method, method_name, &user_def)
|
345
|
+
our_def ||= lambda { super(*actual_arg_for(user_def)) }
|
346
|
+
define_method(method_name, &our_def)
|
347
|
+
end
|
348
|
+
|
349
|
+
# Defines deprecated macro methods from RSpec 2 for backwards compatibility.
|
350
|
+
# @deprecated Use the methods from {Macros} instead.
|
351
|
+
module Deprecated
|
352
|
+
# @deprecated Use {Macros#match} instead.
|
353
|
+
def match_for_should(&definition)
|
354
|
+
RSpec.deprecate("`match_for_should`", :replacement => "`match`")
|
355
|
+
match(&definition)
|
356
|
+
end
|
357
|
+
|
358
|
+
# @deprecated Use {Macros#match_when_negated} instead.
|
359
|
+
def match_for_should_not(&definition)
|
360
|
+
RSpec.deprecate("`match_for_should_not`", :replacement => "`match_when_negated`")
|
361
|
+
match_when_negated(&definition)
|
362
|
+
end
|
363
|
+
|
364
|
+
# @deprecated Use {Macros#failure_message} instead.
|
365
|
+
def failure_message_for_should(&definition)
|
366
|
+
RSpec.deprecate("`failure_message_for_should`", :replacement => "`failure_message`")
|
367
|
+
failure_message(&definition)
|
368
|
+
end
|
369
|
+
|
370
|
+
# @deprecated Use {Macros#failure_message_when_negated} instead.
|
371
|
+
def failure_message_for_should_not(&definition)
|
372
|
+
RSpec.deprecate("`failure_message_for_should_not`", :replacement => "`failure_message_when_negated`")
|
373
|
+
failure_message_when_negated(&definition)
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
# Defines default implementations of the matcher
|
379
|
+
# protocol methods for custom matchers. You can
|
380
|
+
# override any of these using the {RSpec::Matchers::DSL::Macros Macros} methods
|
381
|
+
# from within an `RSpec::Matchers.define` block.
|
382
|
+
module DefaultImplementations
|
383
|
+
include BuiltIn::BaseMatcher::DefaultFailureMessages
|
384
|
+
|
385
|
+
# @api private
|
386
|
+
# Used internally by objects returns by `should` and `should_not`.
|
387
|
+
def diffable?
|
388
|
+
false
|
389
|
+
end
|
390
|
+
|
391
|
+
# The default description.
|
392
|
+
def description
|
393
|
+
english_name = EnglishPhrasing.split_words(name)
|
394
|
+
expected_list = EnglishPhrasing.list(expected)
|
395
|
+
"#{english_name}#{expected_list}#{chained_method_clause_sentences}"
|
396
|
+
end
|
397
|
+
|
398
|
+
# Matchers do not support block expectations by default. You
|
399
|
+
# must opt-in.
|
400
|
+
def supports_block_expectations?
|
401
|
+
false
|
402
|
+
end
|
403
|
+
|
404
|
+
# Most matchers do not expect call stack jumps.
|
405
|
+
def expects_call_stack_jump?
|
406
|
+
false
|
407
|
+
end
|
408
|
+
|
409
|
+
private
|
410
|
+
|
411
|
+
def chained_method_clause_sentences
|
412
|
+
return '' unless Expectations.configuration.include_chain_clauses_in_custom_matcher_descriptions?
|
413
|
+
|
414
|
+
@chained_method_clauses.map do |(method_name, method_args)|
|
415
|
+
english_name = EnglishPhrasing.split_words(method_name)
|
416
|
+
arg_list = EnglishPhrasing.list(method_args)
|
417
|
+
" #{english_name}#{arg_list}"
|
418
|
+
end.join
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
# The class used for custom matchers. The block passed to
|
423
|
+
# `RSpec::Matchers.define` will be evaluated in the context
|
424
|
+
# of the singleton class of an instance, and will have the
|
425
|
+
# {RSpec::Matchers::DSL::Macros Macros} methods available.
|
426
|
+
class Matcher
|
427
|
+
# Provides default implementations for the matcher protocol methods.
|
428
|
+
include DefaultImplementations
|
429
|
+
|
430
|
+
# Allows expectation expressions to be used in the match block.
|
431
|
+
include RSpec::Matchers
|
432
|
+
|
433
|
+
# Supports the matcher composability features of RSpec 3+.
|
434
|
+
include Composable
|
435
|
+
|
436
|
+
# Makes the macro methods available to an `RSpec::Matchers.define` block.
|
437
|
+
extend Macros
|
438
|
+
extend Macros::Deprecated
|
439
|
+
|
440
|
+
# Exposes the value being matched against -- generally the object
|
441
|
+
# object wrapped by `expect`.
|
442
|
+
attr_reader :actual
|
443
|
+
|
444
|
+
# Exposes the exception raised during the matching by `match_unless_raises`.
|
445
|
+
# Could be useful to extract details for a failure message.
|
446
|
+
attr_reader :rescued_exception
|
447
|
+
|
448
|
+
# The block parameter used in the expectation
|
449
|
+
attr_reader :block_arg
|
450
|
+
|
451
|
+
# The name of the matcher.
|
452
|
+
attr_reader :name
|
453
|
+
|
454
|
+
# @api private
|
455
|
+
def initialize(name, declarations, matcher_execution_context, *expected, &block_arg)
|
456
|
+
@name = name
|
457
|
+
@actual = nil
|
458
|
+
@expected_as_array = expected
|
459
|
+
@matcher_execution_context = matcher_execution_context
|
460
|
+
@chained_method_clauses = []
|
461
|
+
@block_arg = block_arg
|
462
|
+
|
463
|
+
class << self
|
464
|
+
# See `Macros#define_user_override` above, for an explanation.
|
465
|
+
include(@user_method_defs = Module.new)
|
466
|
+
self
|
467
|
+
end.class_exec(*expected, &declarations)
|
468
|
+
end
|
469
|
+
|
470
|
+
# Provides the expected value. This will return an array if
|
471
|
+
# multiple arguments were passed to the matcher; otherwise it
|
472
|
+
# will return a single value.
|
473
|
+
# @see #expected_as_array
|
474
|
+
def expected
|
475
|
+
if expected_as_array.size == 1
|
476
|
+
expected_as_array[0]
|
477
|
+
else
|
478
|
+
expected_as_array
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
# Returns the expected value as an an array. This exists primarily
|
483
|
+
# to aid in upgrading from RSpec 2.x, since in RSpec 2, `expected`
|
484
|
+
# always returned an array.
|
485
|
+
# @see #expected
|
486
|
+
attr_reader :expected_as_array
|
487
|
+
|
488
|
+
# Adds the name (rather than a cryptic hex number)
|
489
|
+
# so we can identify an instance of
|
490
|
+
# the matcher in error messages (e.g. for `NoMethodError`)
|
491
|
+
def inspect
|
492
|
+
"#<#{self.class.name} #{name}>"
|
493
|
+
end
|
494
|
+
|
495
|
+
if RUBY_VERSION.to_f >= 1.9
|
496
|
+
# Indicates that this matcher responds to messages
|
497
|
+
# from the `@matcher_execution_context` as well.
|
498
|
+
# Also, supports getting a method object for such methods.
|
499
|
+
def respond_to_missing?(method, include_private=false)
|
500
|
+
super || @matcher_execution_context.respond_to?(method, include_private)
|
501
|
+
end
|
502
|
+
else # for 1.8.7
|
503
|
+
# :nocov:
|
504
|
+
# Indicates that this matcher responds to messages
|
505
|
+
# from the `@matcher_execution_context` as well.
|
506
|
+
def respond_to?(method, include_private=false)
|
507
|
+
super || @matcher_execution_context.respond_to?(method, include_private)
|
508
|
+
end
|
509
|
+
# :nocov:
|
510
|
+
end
|
511
|
+
|
512
|
+
private
|
513
|
+
|
514
|
+
def actual_arg_for(block)
|
515
|
+
block.arity.zero? ? [] : [@actual]
|
516
|
+
end
|
517
|
+
|
518
|
+
# Takes care of forwarding unhandled messages to the
|
519
|
+
# `@matcher_execution_context` (typically the current
|
520
|
+
# running `RSpec::Core::Example`). This is needed by
|
521
|
+
# rspec-rails so that it can define matchers that wrap
|
522
|
+
# Rails' test helper methods, but it's also a useful
|
523
|
+
# feature in its own right.
|
524
|
+
def method_missing(method, *args, &block)
|
525
|
+
if @matcher_execution_context.respond_to?(method)
|
526
|
+
@matcher_execution_context.__send__ method, *args, &block
|
527
|
+
else
|
528
|
+
super(method, *args, &block)
|
529
|
+
end
|
530
|
+
end
|
531
|
+
end
|
532
|
+
end
|
533
|
+
end
|
534
|
+
end
|
data/vendor/bundle/ruby/2.5.0/gems/rspec-expectations-3.9.0/lib/rspec/matchers/english_phrasing.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Matchers
|
3
|
+
# Facilitates converting ruby objects to English phrases.
|
4
|
+
module EnglishPhrasing
|
5
|
+
# Converts a symbol into an English expression.
|
6
|
+
#
|
7
|
+
# split_words(:banana_creme_pie) #=> "banana creme pie"
|
8
|
+
#
|
9
|
+
def self.split_words(sym)
|
10
|
+
sym.to_s.tr('_', ' ')
|
11
|
+
end
|
12
|
+
|
13
|
+
# @note The returned string has a leading space except
|
14
|
+
# when given an empty list.
|
15
|
+
#
|
16
|
+
# Converts an object (often a collection of objects)
|
17
|
+
# into an English list.
|
18
|
+
#
|
19
|
+
# list(['banana', 'kiwi', 'mango'])
|
20
|
+
# #=> " \"banana\", \"kiwi\", and \"mango\""
|
21
|
+
#
|
22
|
+
# Given an empty collection, returns the empty string.
|
23
|
+
#
|
24
|
+
# list([]) #=> ""
|
25
|
+
#
|
26
|
+
def self.list(obj)
|
27
|
+
return " #{RSpec::Support::ObjectFormatter.format(obj)}" if !obj || Struct === obj
|
28
|
+
items = Array(obj).map { |w| RSpec::Support::ObjectFormatter.format(w) }
|
29
|
+
case items.length
|
30
|
+
when 0
|
31
|
+
""
|
32
|
+
when 1
|
33
|
+
" #{items[0]}"
|
34
|
+
when 2
|
35
|
+
" #{items[0]} and #{items[1]}"
|
36
|
+
else
|
37
|
+
" #{items[0...-1].join(', ')}, and #{items[-1]}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
if RUBY_VERSION == '1.8.7'
|
42
|
+
# Not sure why, but on travis on 1.8.7 we have gotten these warnings:
|
43
|
+
# lib/rspec/matchers/english_phrasing.rb:28: warning: default `to_a' will be obsolete
|
44
|
+
# So it appears that `Array` can trigger that (e.g. by calling `to_a` on the passed object?)
|
45
|
+
# So here we replace `Kernel#Array` with our own warning-free implementation for 1.8.7.
|
46
|
+
# @private
|
47
|
+
# rubocop:disable Naming/MethodName
|
48
|
+
def self.Array(obj)
|
49
|
+
case obj
|
50
|
+
when Array then obj
|
51
|
+
else [obj]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
# rubocop:enable Naming/MethodName
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Matchers
|
3
|
+
# @api private
|
4
|
+
# Handles list of expected values when there is a need to render
|
5
|
+
# multiple diffs. Also can handle one value.
|
6
|
+
class ExpectedsForMultipleDiffs
|
7
|
+
# @private
|
8
|
+
# Default diff label when there is only one matcher in diff
|
9
|
+
# output
|
10
|
+
DEFAULT_DIFF_LABEL = "Diff:".freeze
|
11
|
+
|
12
|
+
# @private
|
13
|
+
# Maximum readable matcher description length
|
14
|
+
DESCRIPTION_MAX_LENGTH = 65
|
15
|
+
|
16
|
+
def initialize(expected_list)
|
17
|
+
@expected_list = expected_list
|
18
|
+
end
|
19
|
+
|
20
|
+
# @api private
|
21
|
+
# Wraps provided expected value in instance of
|
22
|
+
# ExpectedForMultipleDiffs. If provided value is already an
|
23
|
+
# ExpectedForMultipleDiffs then it just returns it.
|
24
|
+
# @param [Any] expected value to be wrapped
|
25
|
+
# @return [RSpec::Matchers::ExpectedsForMultipleDiffs]
|
26
|
+
def self.from(expected)
|
27
|
+
return expected if self === expected
|
28
|
+
new([[expected, DEFAULT_DIFF_LABEL]])
|
29
|
+
end
|
30
|
+
|
31
|
+
# @api private
|
32
|
+
# Wraps provided matcher list in instance of
|
33
|
+
# ExpectedForMultipleDiffs.
|
34
|
+
# @param [Array<Any>] matchers list of matchers to wrap
|
35
|
+
# @return [RSpec::Matchers::ExpectedsForMultipleDiffs]
|
36
|
+
def self.for_many_matchers(matchers)
|
37
|
+
new(matchers.map { |m| [m.expected, diff_label_for(m)] })
|
38
|
+
end
|
39
|
+
|
40
|
+
# @api private
|
41
|
+
# Returns message with diff(s) appended for provided differ
|
42
|
+
# factory and actual value if there are any
|
43
|
+
# @param [String] message original failure message
|
44
|
+
# @param [Proc] differ
|
45
|
+
# @param [Any] actual value
|
46
|
+
# @return [String]
|
47
|
+
def message_with_diff(message, differ, actual)
|
48
|
+
diff = diffs(differ, actual)
|
49
|
+
message = "#{message}\n#{diff}" unless diff.empty?
|
50
|
+
message
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
class << self
|
56
|
+
private
|
57
|
+
|
58
|
+
def diff_label_for(matcher)
|
59
|
+
"Diff for (#{truncated(RSpec::Support::ObjectFormatter.format(matcher))}):"
|
60
|
+
end
|
61
|
+
|
62
|
+
def truncated(description)
|
63
|
+
return description if description.length <= DESCRIPTION_MAX_LENGTH
|
64
|
+
description[0...DESCRIPTION_MAX_LENGTH - 3] << "..."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def diffs(differ, actual)
|
69
|
+
@expected_list.map do |(expected, diff_label)|
|
70
|
+
diff = differ.diff(actual, expected)
|
71
|
+
next if diff.strip.empty?
|
72
|
+
if diff == "\e[0m\n\e[0m"
|
73
|
+
"#{diff_label}\n" \
|
74
|
+
" <The diff is empty, are your objects producing identical `#inspect` output?>"
|
75
|
+
else
|
76
|
+
"#{diff_label}#{diff}"
|
77
|
+
end
|
78
|
+
end.compact.join("\n")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|