igneus / calendarium-romanum

liturgical calendar library (Roman Catholic, post-Vatican II)
50 stars 21 forks source link

Specs: execute code examples in YARD documentation #58

Closed igneus closed 3 years ago

igneus commented 4 years ago

Currently all code examples in README.md and data/README.md are executed as part of the gem's test suite (see spec/readme_spec.rb), which doesn't really check their correctness in terms of actually doing what the surrounding text promises, but at least proves that they can be executed without errors (which is important - we love documentation with copy-pastable code examples).

The same kind of "executability check" should be introduced for code examples (only those using the @example annotation) in the gem's YARD documentation.

Where to start: $ grep -r '@example' lib to find occurrences of the @example annotation, then write Ruby code doing the same + extracting the example code. Execute the examples as part of the test suite - analogically to what happens in spec/readme_spec.rb.