On Tuesday 27 September 2005 10:12 pm, Bret Pettichord wrote:
> I put the following line at the top of each of my unit tests for Watir:
>
>    $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 ==
> __FILE__
>
> This ensures that the version of Watir that is being tested is the one that
> is in the same hierarchy as the unit tests (by putting its directory in the
> front of the load-path). You can accomplish the same thing by setting the
> load path at the command line.
>
> ... Unless you are using a gem. I recently started packaging Watir as a gem
> and i now see that, somehow, the gem mechanism prepends the gem library
> directories to the very front, so the gem-installed version is tested
> instead of the one under development.

Bret,

I release all my software as gems  They are installed on my system as gems and 
yet am able to test all my software without contortions.  I use the Rake test 
task to run my tests (and it sets up the library paths on the command line).  

If your software is available in the load path, gems will not attempt load the 
gem in front of that.  An explicit require_gem will try to load a particular 
version of your library, so you don't want to use require_gem in your test 
setup (and probably don't need it in the real code either).

-- 
-- Jim Weirich    jim / weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)