[rspec-users] Could anyone please help with rspec/nested resource behavior checking?
jonathan at parkerhill.com
Fri Jun 1 14:31:15 EDT 2007
I haven't thought it through (no pun intended) but maybe this could
be simplified and generalized , like add a ".through" to the stub and/
On May 31, 2007, at 1:01 AM, Chris Anderson wrote:
> I usually do something like this in my before(:each) section:
> User.stub!(:find).and_return(@u = mock_model(User, :posts => @pc =
> mock('posts collection')))
> @pc.stub(:find).and_return([@p = mock_model(Post)])
> with the corresponding should_receives in my various examples... the
> trick is to mock the user's posts collection as its own object.
More information about the rspec-users