Parse Minitest files to read all the test case descriptions and include those
with the relevant classes in your YARD documentation. This works for both
ActiveSupport-style test
blocks and regular old def test_
methods. Test
cases get listed at the bottom of your class documentation and include the
test source code, file name and line numbers.
This is very much a toy project to play with YARD plugins. If you find it useful then pull requests are welcome.
Add this line to your application's Gemfile:
gem 'yard-minitest'
And then execute:
$ bundle
Or install it yourself as:
$ gem install yard-minitest
YARD::Minitest is a YARD plugin, so you can activate it explicitly when you run
yardoc
:
$ yardoc --plugin minitest
Alternatively, you can have YARD always look for any installed plugin by setting
its load_plugins
configuration:
$ yard config load_plugins true
Remember to include your test files when documenting your project; otherwise your tests will not be found.
$ yardoc app/**/*.rb test/**/*.rb
- Fork it ( https://github.com/avdgaag/yard-minitest/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request