[Rake-devel] Accessing TestTasks (did this post?)

Zach Dennis zach.dennis at gmail.com
Mon Oct 16 16:32:49 EDT 2006


I dont' know if this posted. I tried to send it last week, but I never
saw it come through.. .if this is a double post I apologize. If you do
see this could someone reply so I know that  I am actually getting
through?

Thanks, Zach

--- ORIGINAL MESSAGE ----

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 test_file.rb".

Thanks,

Zach Dennis


More information about the Rake-devel mailing list