[rspec-users] mock_model in spec/lib

David Chelimsky dchelimsky at gmail.com
Thu Aug 30 11:37:55 EDT 2007

On 8/30/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:
> Edward Ocampo-Gooding wrote:
> > David Chelimsky wrote:
> >> On 8/30/07, Edward Ocampo-Gooding <edward.og at gmail.com> 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
> >> mock_model is not supported outside of model, view, controller and
> >> helper specs. Feel free to submit a feature request if you think it
> >> should be.
> >
> > I can kind of understand why it's not, but it'd be good to have an error message
> > that pops informing the user saying as such.
> Also note that in trunk, you can work around this with
> describe my_lib_function, :behaviour_type => :controller (or model, or
> helper, or view)
> which is very useful for lib functions that are used in one of those
> contexts.

Correct - that is the correct usage.

the lib directory is for stuff not related specifically to rails, in my view

> Jay
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list