<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><DIV>On Jan 3, 2007, at 4:48 PM, John Pywtorak wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">So, how would one go about writing</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">a test for check_stat, specifically using mocha?<SPAN class="Apple-converted-space">  </SPAN>Also, attempting to</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">eliminate all trips to the database, because testing #check_stat does</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">not need it.<SPAN class="Apple-converted-space">  </SPAN>The db connection and all the active record magic are</FONT></P> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">tested elsewhere right?</FONT></P> </BLOCKQUOTE></DIV><BR><DIV>If you want to eliminate all trips to the database and unit test check_stat you can do this: <A href="http://jayfields.blogspot.com/2006/12/rails-activerecord-unit-testing.html">http://jayfields.blogspot.com/2006/12/rails-activerecord-unit-testing.html</A></DIV></BODY></HTML>