2009/6/18 Phlip <[email protected]>:
>
> Colin Law wrote:
>
>>> require File.dirname(__FILE__) + '/../test_helper'
>>>
>>> I'm hoping there is a better way?  Maybe a fix in edge rails?  Anyone
>>> have an update?
>>
>> The recommended way of avoiding this issue is to use
>> ruby -I test test/unit/whatever.rb
>
> How to get that inside your rake test script?

You don't, the OP referred to the problem that if you run a unit test
from the command line you get the error. If instead of running the
unit test by

ruby test/unit/whatever.rb

you use

ruby -I test test/unit/whatever.rb

the error does not appear as the test directory is included in the ruby path.

The problem does not appear in the first place when using rake test

Colin

>
>> Apparently putting the dirname in the require can cause all sorts of
>> issues that I do not understand and we just have to put up with it.  (
>> I don't mean we have to put up with not understanding it).
>
> require '../foo' and require '../../bar/foo' will both load foo.rb twice. This
> is usually not what you want, but it's a simplification in the current require
> system. Because all unit tests should run in the same VM, the ones in 
> different
> folders will load test_helper again.
>
> Won't this fix it?
>
> $:.unshift File.dirname(__FILE__) + '/../'
> require 'test_helper'
>
> Then the second occurrence of require 'test_helper' will not load twice, even 
> if
> (on some dementedly configured system), the require File.dirname(__FILE__) +
> '/../test_helper' could have instead loaded a different one.
>
> --
>   Phlip
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to