[rspec-users] spec_server requiring absolute paths (and autotest breaking)

Scott Taylor mailing_lists at railsnewbie.com
Tue Feb 19 23:55:12 EST 2008

On Feb 19, 2008, at 12:08 PM, Jarkko Laine wrote:

> On 19.2.2008, at 17.57, David Chelimsky wrote:
>> Did this just start happening for you? If so, it could be the patch I
>> applied in r3310. Would you mind checking out 3309 and seeing if you
>> still have this problem?
> Ok, found out the reason. I started spec_server from within the  
> script directory and it only works correctly if you start it from  
> the root of your Rails app. Gotcha.
> That said, now that autotest runs via drb, it's vastly (like 50%)  
> slower than without it,

That's the idea.

> doesn't respect the --colour option in spec.opts

That's been a bug since 0.6 or 0.7 when I started with rspec.  I  
guess not enough people have used the spec server for it to be  
already patched.

I'll take a look at fixing it this weekend.

> and causes failures that don't happen when running just plain  
> autotest.

> All of them seem to be related to methods being run more times than  
> they are supposed to. Examples:
> Mock 'Location_18994' expected :valid? with (any args) once, but  
> received it twice

I saw this happen recently when the spec server was started twice:  
once with the rake task (rake spec:server:start), the other with a  
straight script/spec_sever.  My hunch is that both servers are  
loading the files at the same time.

> expected: "Barney Hops doesn't have the required competency (MBA)  
> to teach this class",
>      got: ["Barney Hops doesn't have the required competency (MBA)  
> to teach this class", "Barney Hops doesn't have the required  
> competency (MBA) to teach this class"]

Yeah - this is because rails load's instead of requires.  You'll also  
see this sort of thing if you just call load directly in your specs.   
I've never dug deeper into how all of the rails magic happens  
regarding loading and constants (and the method generation with the  
association macros (has_* belongs_to), so if you have any insight,  
I'd be happy to hear it.


More information about the rspec-users mailing list