Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread David Chelimsky
On Wed, Aug 27, 2008 at 2:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: >> Here's the basic deal: >> >> Model.find(1).equal?(Model.find(1)) >> => false >> >> AR does not cache objects, so when you ask it for what you *think* >> might the same object twice, you get different ones. > > I thought as mu

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Matt Wynne
On 27 Aug 2008, at 13:26, David Chelimsky wrote: On Wed, Aug 27, 2008 at 7:22 AM, Zach Dennis <[EMAIL PROTECTED]> wrote: On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: Here's the basic deal: Model.find(1).equal?(Model.find(1)) => false AR does not cache objects, so

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread David Chelimsky
On Wed, Aug 27, 2008 at 7:22 AM, Zach Dennis <[EMAIL PROTECTED]> wrote: > On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: >>> Here's the basic deal: >>> >>> Model.find(1).equal?(Model.find(1)) >>> => false >>> >>> AR does not cache objects, so when you ask it for what you *th

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Zach Dennis
On Wed, Aug 27, 2008 at 3:34 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: >> Here's the basic deal: >> >> Model.find(1).equal?(Model.find(1)) >> => false >> >> AR does not cache objects, so when you ask it for what you *think* >> might the same object twice, you get different ones. > > I thought as mu

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-27 Thread Matt Wynne
Here's the basic deal: Model.find(1).equal?(Model.find(1)) => false AR does not cache objects, so when you ask it for what you *think* might the same object twice, you get different ones. I thought as much... So does AR just cache the object's attributes instead and construct them on the fly

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-26 Thread Zach Dennis
On Tue, Aug 26, 2008 at 10:03 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Tue, Aug 26, 2008 at 8:51 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: >> On Tue, Aug 26, 2008 at 5:01 PM, David Chelimsky <[EMAIL PROTECTED]> >> wrote: >> >>> >>> @target_comment = stub_model(Target) >>> @target.stub!(

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-26 Thread David Chelimsky
On Tue, Aug 26, 2008 at 8:51 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > On Tue, Aug 26, 2008 at 5:01 PM, David Chelimsky <[EMAIL PROTECTED]> > wrote: > >> >> @target_comment = stub_model(Target) >> @target.stub!(:comments).and_return([EMAIL PROTECTED]) > > That's what we do - what would the drawb

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-26 Thread Mark Wilden
On Tue, Aug 26, 2008 at 5:01 PM, David Chelimsky <[EMAIL PROTECTED]>wrote: > @target_comment = stub_model(Target) > @target.stub!(:comments).and_return([EMAIL PROTECTED]) > That's what we do - what would the drawbacks be? ///ark ___ rspec-users mailin

Re: [rspec-users] stub_model() and ActiveRecord Associations

2008-08-26 Thread David Chelimsky
On Tue, Aug 26, 2008 at 1:34 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: > Hi all, > I have what I thought was quite a simple requirement but something to do > with the way ActiveRecord's associations work is making it quite puzzling. > I guess I can sum it up with this failing test: > before

[rspec-users] stub_model() and ActiveRecord Associations

2008-08-26 Thread Matt Wynne
Hi all, I have what I thought was quite a simple requirement but something to do with the way ActiveRecord's associations work is making it quite puzzling. I guess I can sum it up with this failing test: before(:each) do @source_comment = @source.comments.create(:user_id