[rspec-users] Mocking and stubbing model relationships

Nick Hoffman nick at deadorange.com
Tue Nov 18 00:41:36 EST 2008

Before writing specs for a one-to-many relationship between two  
models, I did some research and found that some people were creating  
proxy mocks, and others were using Matthew Heidemann's  
#stub_association! (which essentially does that for, but in a nice,  
DRY way):

Are those two methods currently the accepted "best practice" for  
mocking and stubbing calls such like these?:

@properties = @user.properties
@property = @user.properties.new
@property = @user.properties.find_by_id params[:id]


More information about the rspec-users mailing list