Running a rake test task within a specific directory


#1

Hi all,

I’m trying to figure out how to setup a task that temporarily changes
to a specific directory, runs the tests, and returns to the current
directory when finished. In case you’re wondering why, I have some test
cases that create temporary files (in the setup method), use those temp
files in the tests themselves, and then delete them (in the teardown
method).

While I could jump through hoops to make sure the proper path of the
temp files are found within each test case, I’d rather not. I was
hoping to do something like this:

Rake::TestTask.new(‘test_file’) do |test|
Dir.chdir(‘test/core/File’) do
test.test_files = FileList[’/.rb’]
end
end

Unfortunately, that doesn’t seem to work, and I’m not sure why. Any
ideas?

Thanks,

Dan

PS - On an unrelated note, I hate this new google groups interface. I
can’t see my subscribed groups on the same page (it’s an extra click
away now), and there’s no more “preview” option in the compose window.
Oh, and the color scheme is depressing. BARF!