Skip to content

When adding a new feature

wallyqs edited this page Dec 16, 2012 · 4 revisions
$ rake -T

rake testcase                  # Alias for testcase:list
rake testcase:accept[case]     # Accept the current org-ruby output for the test case as correct
rake testcase:inspect[case]    # Look at the current org-ruby output for a test case
rake testcase:list             # List all of the current HTML test cases

Those are some of the useful rake tasks that Brian wrote to test the org-ruby output.

The flow for adding a new feature would be something like this:

  • Modify or add the org file with an example of the feature you want to add e.g. spec/html_examples/custom-todo.org
  • Modify the spec file that describes that behavior. e.g. spec/parser_spec.rb
  • Have fun adding the feature :)
  • While developing, you can run the testcase:inspect[custom-todo] rake task to preview your changes
  • When your tests pass, run the testcase:accept rake task to update the spec’s output html file.

Testing Syntax highlight examples

Since version 0.7.0, org-ruby also supports syntax highlighting #+BEGIN_SRC code blocks. The procedure for testing these is a bit different:

$ rake -T

# Depending on the user setup, either coderay or pygments (or neither) would be available,
# so we choose one of these and run rake spec individually
bundle --without pygments:coderay     # Does not use syntax highlight
bundle --without pygments             # Does not use pygments, so use coderay instead
bundle --without coderay              # Does not use coderay, so uses pygments instead
rake spec

# Or we can run all syntax highlight tests (with pygments, coderay and without none)
rake test                             

# Tasks for accepting syntax highlight testcases
rake testcase:highlight:inspect[case] # Look at the current org-ruby output for a test case
rake testcase:highlight:accept[case]  # Accept the current org-ruby output for the test case as correct
Clone this wiki locally