Thanks Bill - because the library file is one directory above each test
suite, I have each require "../library.rb".  I removed the "../" and
used the $LOAD_PATH relative statement you listed, and everything seems
to be working great!

Now to go back and make this change in each test manually...

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bill Agee
Sent: Friday, March 30, 2007 4:31 PM
To: [email protected]
Subject: Re: [Wtr-general] watir execution from webserver

For a quick fix, try adding this to the top of your
c:/runner/data/suites/project/test.rb file (before any require
statements):

  $LOAD_PATH.unshift "c:/runner/data/suites/" if $0 == __FILE__

That way when test.rb is executed, the suites dir will be added to
$LOAD_PATH, and "require 'library'" will load the
c:/runner/data/suites/library.rb file.

But the way I usually see this done is to add relative dirs to
$LOAD_PATH instead of absolute paths.  That way the files you require
will still be found even if the directory structure they live in
changes.

For example, in test.rb you might add at the top:

  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 ==
__FILE__

So if test.rb is in c:/runner/data/suites/project, this will find the
name of the dir one level up from __FILE__'s dir
(c:/runner/data/suites/) and add it to $LOAD_PATH.

If all else fails, you might try dropping library.rb into one of the
default $LOAD_PATH dirs (even though this isn't a very portable
solution).  Such as:

  C:\ruby\lib\ruby\site_ruby\1.8\
_______________________________________________
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