On 2008-11-18, at 07:33, Rahoul Baruah wrote:
On 18 Nov 2008, at 05:41, Nick Hoffman wrote:
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):
http://www.ruby-forum.com/topic/126993
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]
There's also Luke Redpath's Demeter's Revenge plugin (http://www.lukeredpath.co.uk/2007/10/18/demeters-revenge
or git cloned to http://github.com/caius/demeters_revenge/tree/master)
.
Thanks for pointing out that article, Baz. Luke's suggestions are an
interesting method of dealing with this. I'm going to give it a try
when I have some time.
-Nick
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users