search for: hillyerd

Displaying 3 results from an estimated 3 matches for "hillyerd".

2007 Apr 20
7
Stubbing Model.new w/ block?
...!(:new).and_yield(@receipt) Then @receipt in my model will be set to the return value of the block. I also tried something along the lines of: Receipt.stub!(:new) do yield @receipt @receipt end but got some weird no block error. Help? Am I going about this all wrong? -james -- James A. Hillyerd <james at hillyerd.com> Chief Technical Officer - ActiveRain Corp
2007 Apr 19
5
Best practice thoughts: Model helpers, mocks
...r=) @member.stub!(:membership_expires_on=) @member.stub!(:save!) session[:member] = @member end (I have since learned that mock_models do stub out a unique ID value, so I don''t set those by hand on my newer tests) Thanks for any opinions or insight. :) -james -- James A. Hillyerd <james at hillyerd.com>
2007 Apr 30
4
Mocking with Calculated Results
I am setting up an AR mock object and wanted to sanity check it. My intent is to mix this into all my examples and then override/add methods where necessary. Note that I''ve anticipated three cases for find: find with one numeric argument => object find with :all => Array find with anything else => nil This roughly approximates how ActiveRecord::find works in this case