[rspec-users] Mocking and stubbing Rails' association extensions

Chris Kampmeier chris at kampers.net
Thu Jan 10 14:38:55 EST 2008

On 1/10/08, Rick DeNatale <rick.denatale at gmail.com> wrote:
> So why not
> songs = [song1, song2, song3]
> album.stub!(:songs).and_return(songs)
> songs.stub!(:streamable).and_return([song1, song2])

Oh, of course. Thank you.

I think my mind was in a rut of "must use mock or mock_model" and I didn't
think to just stub a method call on an existing array.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080110/db2d6c94/attachment.html 

More information about the rspec-users mailing list