Running a rake test task within a specific directory

Discussion in 'Ruby' started by Daniel Berger, Jan 25, 2007.

  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!
     
    Daniel Berger, Jan 25, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. peppermonkey
    Replies:
    1
    Views:
    246
    Gregory Brown
    Feb 10, 2007
  2. Stéphane Wirtel
    Replies:
    3
    Views:
    375
    Stephane Wirtel
    Jun 15, 2007
  3. Adam Anderson
    Replies:
    1
    Views:
    132
    Adam Anderson
    Sep 19, 2007
  4. James Mead
    Replies:
    0
    Views:
    145
    James Mead
    Jan 15, 2008
  5. Daniel Berger

    Rake post test task

    Daniel Berger, Feb 18, 2009, in forum: Ruby
    Replies:
    9
    Views:
    158
    Daniel Berger
    Feb 26, 2009
Loading...

Share This Page