public
Description: Ruby version of Python's doctest tool, but a bit different
Home | Edit | New

Rails Usage

The “doctest_require:” Directive

See the Special Directives for a full explanation of the

doctest_require:
directive. To get started quickly in rails, this is probably the directive you will want to use in order to load the environment.rb file before the file gets loaded.

Example Usage

doctest_require: "../../config/environment"

By putting the above line before anything in your file (say, app/model/book.rb) you will have DocTest load the Rails environment before it runs the tests in your documentation.

You can specify rails’ environment thus:

doctest_require: ENV['RAILS_ENV'] = 'test'; "../../config/environment"

Last edited by rdp, Fri Aug 15 11:25:32 -0700 2008
Home | Edit | New
Versions: