#!/usr/bin/env litrb run
First we create an empty class to test.
class Foo
end
Now we define a test for the above code block.
spec 'I pity the Foo' { Foo.name == 'Foo' }
Important things to note:
- When the program is run normally (with
litrb run file.rb
) all~~~
blocks are concatenated and run, ignoring everything else. - When we run tests (with
litrb test file.rb
) it will load the~~~
blocks as above and then run the>
blocks in a namespaced DSL. - When we generate docs (with
litrb docs file.rb
) it will generate nice HTML docs from the literate markdown file.