CS 214: Programming Languages
Spring 2009

Home|Syllabus|Schedule

Ruby Templates

If you follow the convensions and helper files suggested here, you will have the following rake tasks:

Files

Usually a test file is named based on the class its trying to test, but not always. A test file looks like this:

ClassNameTest

require 'test/unit'

# TODO: change the name of this class
class ClassNameTest < Test::Unit::TestCase
  # TODO: replace this test method with something more interesting
  def test_something
    assert false, "write some real tests"
  end
  
  # TODO: write more tests!
end

Rakefile

In _languages/ruby, put this file:

ruby.rake

require 'rake/testtask'

Rake::TestTask.new do |t|
  t.test_files = FileList['*_test.rb']
  t.verbose = true
end

Then each Rakefile looks like this:

Rakefile

load '../ruby.rake'