You might consider something like this - putting all your shared files in a
common lib directory.

/test_root
--/lib
    -- variables.rb
    -- includeme.rb

--/login_tests
    -- testfile.rb
    -- testfile2.rb
--/other_functional_area
etc.

Then in your test files, you could put

require File.dirname(__FILE__) + '/../lib/variables'

This should load the variable.rb file (notice that .rb is not needed)
regardless of where you are running it from. If you don't want to use the
lib directory idea, you can use the same method - just change the require
line to

require File.dirname(__FILE__) + '/../variables'

HTH,
Keith



On 4/24/06 4:34 PM, "Michael Moore" <[EMAIL PROTECTED]> wrote:

>> When I try to run login.rb from a sub folder, it fails on "require
>> 'variables.rb'", as it's looking in the current directory, which is a
>> folder down from variables.rb.
>> 
>> Is there a way to let login.rb know where variables.rb is at, without
>> putting in a hard path?
> 
> I found something online that mentioned sending DOS commands, so now
> my loads in the subfolders look like this (and work)
> 
> Dir.chdir("..")
> load 'login.rb'
> Dir.chdir("Tests")
> 
> It moves me up to run the login script, then back down to run the rest
> of the test.
> 
> Thanks,
> --
> Michael Moore
> -------------------------------
> www.stuporglue.org -- Donate your used computer to a student that needs it.
> www.ubuntu-utah.org -- In Utah? Interested in Ubuntu? Come join us.
> 
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to