Forum: Ruby Running a rake test task within a specific directory

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel B. (Guest)
on 2007-01-25 17:30
(Received via mailing list)
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!
This topic is locked and can not be replied to.