[Ruby] Weird Rails Class Inheritance Bug

Eric Hodel drbrain at segment7.net
Mon Jul 17 22:01:29 PDT 2006


On Jul 17, 2006, at 3:55 PM, Geoffrey Grosenbach wrote:

> http://pastie.caboo.se/4990
>
> I wrote a class method that loads all my fixtures at once, and it
> works well for test classes that inherit straight from
> Test::Unit::TestCase.
>
> But classes that inherit from sub-classes of T::U::TC lose the
> special instance methods created by Rails: users(:bob).id, etc..
>
> Is this a bug in my understanding of class inheritance, or is Rails
> doing weird things when it loads fixtures? It seems that my
> subclasses should get all the instance methods that are added to
> Test::Unit::TestCase.

Try having load_all_fixtures simply call fixture $1.  This keeps you  
in the public interface for fixtures so maybe the strange happenings  
will go away.

Fixtures do seem to be inherited in my other test cases.

-- 
Eric Hodel - drbrain at segment7.net - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com




More information about the Ruby mailing list