Re: [rspec-users] Mocking and stubbing model relationships

2008-11-20 Thread Ben Mabey
Nick Hoffman wrote: On 2008-11-18, at 15:49, Ben Mabey wrote: 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! (whi

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-20 Thread Nick Hoffman
On 2008-11-19, at 12:26, Chris Flipse wrote: I've actually taken this old gem and enhanced it a bit module Spec::Mocks::Methods def stub_association!(association_name, methods_to_be_stubbed ={}) mock_assn = Spec::Mocks::Mock.new(association_name.to_s) stub_association_with(association_

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-20 Thread Nick Hoffman
On 2008-11-18, at 15:49, Ben Mabey wrote: 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 doe

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-20 Thread Nick Hoffman
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_assoc

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-19 Thread Chris Flipse
I've actually taken this old gem and enhanced it a bit module Spec::Mocks::Methods def stub_association!(association_name, methods_to_be_stubbed ={}) mock_assn = Spec::Mocks::Mock.new(association_name.to_s) stub_association_with(association_name, mock_assn, methods_to_be_stubbed) end

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-18 Thread Ben Mabey
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:

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-18 Thread Rahoul Baruah
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 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_ass

Re: [rspec-users] Mocking and stubbing model relationships

2008-11-18 Thread Matt Wynne
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 i

[rspec-users] Mocking and stubbing model relationships

2008-11-17 Thread Nick Hoffman
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.