Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-07 Thread Mark Wilden
On Sat, Sep 6, 2008 at 8:00 PM, David Chelimsky [EMAIL PROTECTED]wrote: class Property def add_marker_to(map) map.add_marker Marker.new(address, latitude, longitude, contents) end end That reduces the surface contact between the Property and the Map even more. The surface contact

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread Nick Hoffman
On 2008-09-05, at 18:22, Jonathan Linowes wrote: On Sep 5, 2008, at 5:44 PM, Nick Hoffman wrote: Property.stub!(:find).and_return mock_property1, mock_property2 try Property.stub!(:find).and_return( [mock_property1, mock_property2] ) Thanks Jonathan and David. That was a silly mistake.

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread David Chelimsky
On Sat, Sep 6, 2008 at 2:32 PM, Nick Hoffman [EMAIL PROTECTED] wrote: On 2008-09-05, at 18:22, Jonathan Linowes wrote: On Sep 5, 2008, at 5:44 PM, Nick Hoffman wrote: Property.stub!(:find).and_return mock_property1, mock_property2 try Property.stub!(:find).and_return( [mock_property1,

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread Nick Hoffman
On 2008-09-06, at 15:58, David Chelimsky wrote: Well, without changing the underlying semantics, you can clean up the syntax a bit like this: mock_property1 = stub('property', :address = '400 Bloor Street', :latitude = 12.34, :longitude = 56.78) Of course, that doesn't address your question

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread Mark Wilden
203 204 map.should_receive(:add_marker).with mock_property1.address, mock_property1.latitude, mock_property1.longitude, marker1_contents 205 map.should_receive(:add_marker).with mock_property2.address, mock_property2.latitude, mock_property2.longitude, marker2_contents It looks

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread David Chelimsky
On Sat, Sep 6, 2008 at 4:48 PM, Nick Hoffman [EMAIL PROTECTED] wrote: On 2008-09-06, at 15:58, David Chelimsky wrote: Well, without changing the underlying semantics, you can clean up the syntax a bit like this: mock_property1 = stub('property', :address = '400 Bloor Street', :latitude =

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread David Chelimsky
On Sat, Sep 6, 2008 at 5:25 PM, Mark Wilden [EMAIL PROTECTED] wrote: 203 204 map.should_receive(:add_marker).with mock_property1.address, mock_property1.latitude, mock_property1.longitude, marker1_contents 205 map.should_receive(:add_marker).with mock_property2.address,

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-06 Thread David Chelimsky
On Sat, Sep 6, 2008 at 9:57 PM, David Chelimsky [EMAIL PROTECTED] wrote: On Sat, Sep 6, 2008 at 4:48 PM, Nick Hoffman [EMAIL PROTECTED] wrote: On 2008-09-06, at 15:58, David Chelimsky wrote: Well, without changing the underlying semantics, you can clean up the syntax a bit like this:

[rspec-users] 2nd attempt at mocking and stubbing

2008-09-05 Thread Nick Hoffman
So, after reading all of those fantastic emails discussing testing behaviour vs state, I decided to try mocking and stubbing a couple of methods. I think I did well on my first one, but I'm not sure what the best way to spec the following method is: 1 class RentalMap ... 166 def

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-05 Thread Jonathan Linowes
On Sep 5, 2008, at 5:44 PM, Nick Hoffman wrote: Property.stub!(:find).and_return mock_property1, mock_property2 try Property.stub!(:find).and_return( [mock_property1, mock_property2] ) Want to help others? Become a certified

Re: [rspec-users] 2nd attempt at mocking and stubbing

2008-09-05 Thread David Chelimsky
On Fri, Sep 5, 2008 at 4:44 PM, Nick Hoffman [EMAIL PROTECTED] wrote: So, after reading all of those fantastic emails discussing testing behaviour vs state, I decided to try mocking and stubbing a couple of methods. I think I did well on my first one, but I'm not sure what the best way to spec