[rspec-users] mock_model in spec/lib

Jay Levitt lists-rspec at shopwatch.org
Thu Aug 30 10:16:16 EDT 2007


Edward Ocampo-Gooding wrote:
> Has anyone else run into a problem with trying to use mock_model in spec/lib ? 
> For some reason, I can take the same spec, put it in spec/models, have it run 
> fine, but put it in spec/lib, and have it complain about not being able to find 
> #mock_model

Interesting.  At first glance, at least, it looks like all of the 
controller/view/model behaviour includes base.rb's EvalContext, but if 
you're not in any of those behaviours, you don't get the base behaviour 
either - "general" specs don't get EvalBehaviour.  I'm not positive, 
because I can't find the bit that loads (dir_name)Behaviours at the 
moment, but I think that's what's happening.

I'm not sure if this is a bug or an enhancement request, and if the 
right behaviour is to have all Rails specs get EvalBehaviour if they 
don't live in a special-case dir, or if it would be better for lib to be 
another special case.

Jay Levitt



More information about the rspec-users mailing list