/rspec-documentation

Generate documentation from RSpec examples embedded in Markdown

Primary LanguageJavaScript

RSpec::Documentation

RSpec Documentation provides a simple but powerful system for generating Ruby documentation using RSpec designed to help you ensure that all code examples in your documentation really work.

  • Create a tree of Markdown files in your project directory under rspec-documentation/pages/.
  • Embed tests in ```rspec code blocks (other output formatters are available - see examples).
  • Define a subject for each test.
  • Run the provided rspec-documentation command.

There is no DSL to learn and vanilla RSpec examples are used to generate inputs and outputs. No Markdown language extensions are used, simply define the language of a fenced code block as rspec in any .md file and RSpecDocumentation will do the rest.

Quick Example

The following is an example Markdown file.

# An example test

This is a very simple test:

```rspec
subject { 'my subject' }
it { is_expected.to eql 'my subject' }
```

Documentation

View the full documentation (built using Rspec Documentation!) for detailed usage instructions.