[rspec-users] [rspec]spec_server: already initialized constant MyTestClass

Scott Taylor scott at railsnewbie.com
Wed May 27 17:03:51 EDT 2009


On May 27, 2009, at 4:59 PM, Matt Wynne wrote:

>
> On 27 May 2009, at 14:36, Scott Taylor wrote:
>
>> David Chelimsky wrote:
>>> On Fri, May 1, 2009 at 12:26 PM, Matt Wynne <matt at mattwynne.net>  
>>> wrote:
>>>
>>>> I'm creating a class in my spec file to test out a module, but  
>>>> when I run
>>>> the spec a second time in spec_server, I get the error above.
>>>>
>>>> I presume this is because rails is un-loading the class, and it's  
>>>> not
>>>> getting re-loaded properly as it doesn't have its own file in the
>>>> conventional place.
>>>>
>>>> Does anyone have a nice workaround for this?
>>>>
>>>
>>>
>>
>> Have you tried manually loading the file in the spec itself?
>>
>> Scott
>
> erm.... I create the class *in the spec* itself so not sure how I'd  
> do that. I think I might be better off using an anonymous type  
> instead.

Is it some sort of class only used for testing behaviour inherited  
from AR::Base?

Scott



More information about the rspec-users mailing list