Class: YARD::CLI::TestExamples Private
- Inherits:
-
Command
- Object
- Command
- YARD::CLI::TestExamples
- Defined in:
- lib/yard/cli/test_examples.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Implements the yard test-examples command
Registered with YARD's command dispatcher so that running
yard test-examples [paths...] [options] invokes #run. The full
pipeline is:
- #parse_files — expand the given paths/globs into
.rbfile paths, defaulting toapp/andlib/when none are given. - #parse_examples — YARD-parse those files and collect every
@exampletag from the registry. - #add_pwd_to_path — ensure the current working directory is on
$LOAD_PATHso thatrequirecalls inside examples resolve correctly. - #generate_tests — convert each tag into a YardExampleTest::Example
and register it as a
Minitest::Spec. - #run_tests — schedule the specs to run via
Minitest.autorunwhen the process exits.
Instance Method Summary collapse
-
#description ⇒ String
private
Returns the one-line description of the command shown in
yard help. -
#run(*args)
private
Runs the command line, parsing arguments and generating tests.
Instance Method Details
#description ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the one-line description of the command shown in yard help
49 50 51 |
# File 'lib/yard/cli/test_examples.rb', line 49 def description 'Run @example tags as tests' end |
#run(*args)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Runs the command line, parsing arguments and generating tests
60 61 62 63 64 65 66 |
# File 'lib/yard/cli/test_examples.rb', line 60 def run(*args) files = parse_files(args.grep_v(/^-/)) examples = parse_examples(files) add_pwd_to_path generate_tests(examples) run_tests end |