[LRUG] testing a simple ruby project (no rails - just ruby)

James Adam james.adam at gmail.com
Tue Feb 19 09:40:55 PST 2008


On 19/02/2008, Dafydd Rees <daf at dafydd.net> wrote:
> So why do I get "1 tests" - I have "tc_a.rb" and "tc_b.rb" as you can
> see from the rake output. (I know it's running both - because it can
> pick up failures in both test cases.)

Do your tests have the same name? Is the TestCase subclass in tc_a.rb
different from that in tc_b.rb? I.e. does it have a different name?

> QUESTION 2: How can I recursively pick up and run all the tests under
> the 'test' directory - just like it works in rails?

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

Rake::TestTask.new(:default) do |t|
  t.libs << 'test'
  t.test_files = './test/**/*.rb'
  t.verbose = true
end

.. it's the '**' that's doing the magic here.

HTH,

James

-- 
* J *
  ~



More information about the Chat mailing list