[Rake-devel] Accessing TestTask's

Zach Dennis zach.dennis at gmail.com
Fri Oct 13 00:30:23 EDT 2006


I am extending another library which has it's own rakefile of tasks and
testtasks. I want hook into those TestTasks and supply some additional
options so I can verify my extended functionality doesn't break
functionality in the original library.

I know in my Rakefile I can load the other Rakefile, and access it's
Rake::Tasks, but I cannot access any TestTasks. I have done a small hack to
rake's testtask.rb file which makes use of the RUBYOPTS variable (much like
TESTOPTS). This works, however it requires that I modify rake.

Is there an existing solution to do this, or could I ask for feature request
/ submit a patch for this to get added to Rake?

The exact scenario I have is I am extending ActiveRecord. ActiveRecord
defines many of its own Rake::TestTask's for use with several database
adapter. For example to test ActiveRecord with mysql you run "rake
test_mysql".  In my application I am defining a task
"test:activerecord:mysql" which tests my library against the same rake tasks
as the "rake test_mysql" ran. Since the default TestTask loader just runs a
new ruby interpretor I wanted to add that it required my 'init.rb' file
before running the tests.

I ultimately am looking for behavior where running a TestTask which would
run "ruby -Ilib test_file.rb" would possibly run "ruby -r init.rb -Ilib


Zach Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rake-devel/attachments/20061013/cd21c534/attachment-0001.html 

More information about the Rake-devel mailing list