Typically, I'd write a method in your user model that returns the user's articles:<br><br>class User do<br><br> def find_articles_for_user<br> Article.find(:all, :conditions => ['userid = ?', id)<br> end
<br><br>end<br><br>Then you'd use a mock in your controller spec, and make sure you test that your method is being called.<br><br>On the other hand, the user model should be tested directly against the db.<br><br>HTH,
<br><br>Stefan<br><br><div><span class="gmail_quote">2007/12/3, Fischer, Daniel <<a href="mailto:daniel@helpmebuyacar.org">daniel@helpmebuyacar.org</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Let's say you're using the restful_authentication plugin.<div><br></div><div>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.
</div><div><br></div><div>It should NOT include any articles other than the articles that user owns.</div><div><br></div><div>How would you properly spec this out?
</div><div><br></div><div>Thanks for the help!</div>
<br>_______________________________________________<br>rspec-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">
http://rubyforge.org/mailman/listinfo/rspec-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Bekk Open Source<br><a href="http://boss.bekk.no">http://boss.bekk.no</a>