[rspec-users] Why do I have to require_dependency here?
ashley.moran at patchspace.co.uk
Mon Apr 7 16:01:09 EDT 2008
This was bugging the hell out of me until I found a fix just. I have
been getting reams and reams of errors from reference to one model
class in a controller spec. Here's one of the 57 that go wrong:
LoadError in 'UsersController PUT /users/:id when the model is invalid
and there is no primary user issue and the user clicked Save should
not assign the primary user issue to the view'
app/models/user_state.rb to define UserState
But the weird thing is it ONLY happens when you run the spec in
isolation. As part of a full autotest run, it's fine.
The fix is to put this at the top of the controller file:
Any idea what could be going wrong? It's not the first class loader
issue I've hit, when I see a pattern I'll file a ticket. Just
wondered if this was new to everyone here.
More information about the rspec-users