[mocha-developer] Stubbing ActiveRecord Models gets very difficult with instance methods

John Pywtorak jpywtora at calpoly.edu
Thu Jan 4 22:05:45 EST 2007


Jay wrote:
> On Jan 3, 2007, at 4:48 PM, John Pywtorak wrote:
> 
>> So, how would one go about writing
>>
>> a test for check_stat, specifically using mocha?  Also, attempting to
>>
>> eliminate all trips to the database, because testing #check_stat does
>>
>> not need it.  The db connection and all the active record magic are
>>
>> tested elsewhere right?
>>
> 
> If you want to eliminate all trips to the database and unit test 
> check_stat you can do 
> this: http://jayfields.blogspot.com/2006/12/rails-activerecord-unit-testing.html

Thanks.  I had looked sometime ago and very little had been blogged 
about, or other.  For various reasons I had not stayed up on Jay's blog, 
so wow, I am seeing my questions answered within his posts.  Thank you Jay.

http://ruby-talk.blogspot.com


More information about the mocha-developer mailing list