just in ram

A list of stuff I should remember but never do

Ruby unit testing – Setting up your project folder for testing

without comments

Its a good idea to keep your test cases seperate from your production code:

  myproject
      lib/
          workomatic.rb
      test/
          test_workomatic.rb

When you have your project setup in this way add the following line to the top of your test cases:

Inside test_workomatic.rb

  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
  require workomatic.rb

Now when you run this test case the workomatic.rb file and all supporting files in the lib folder will be picked up.

Written by Justin Ramel

March 30th, 2006 at 9:22 pm

Posted in General

Leave a Reply