[rspec-users] Need help mocking this out
me at danielfischer.com
Mon Dec 3 05:33:44 EST 2007
yuck, that seems kind of nasty, no?
user.articles is already scoped...
There has to be a different solution!
On Dec 3, 2007 2:07 AM, Stefan Magnus Landrø <stefan.landro at gmail.com>
> Typically, I'd write a method in your user model that returns the user's
> class User do
> def find_articles_for_user
> Article.find(:all, :conditions => ['userid = ?', id)
> Then you'd use a mock in your controller spec, and make sure you test that
> your method is being called.
> On the other hand, the user model should be tested directly against the
> 2007/12/3, Fischer, Daniel <daniel at helpmebuyacar.org>:
> > Let's say you're using the restful_authentication plugin.
> > You have a model called articles. On the index action of the
> > articlescontroller you simply want to spec out that it'll scope the results
> > to the ownership of the current_user.
> > It should NOT include any articles other than the articles that user
> > owns.
> > How would you properly spec this out?
> > Thanks for the help!
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> Bekk Open Source
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users