Topic: mocks vs stubs for beginner :: rspec examples
Please excuse me, for this has been here before (probably, many times) but I've honestly read everything relevant in google (including Martin Fowler) and here and still I have no deep enough understanding of the subject.
What I want here is simple, but well-grounded explanation of the difference between mocks and stubs and real examples when these two approaches can't substitute each other.
The way I see the difference between those two:
saved_photo = mock(Img)
saved_img.should_receive(:update_attributes).and_return true
and
Img.stub!(:update_attributes).and_return true
is that the first one fakes an instance method, while the second one fakes a class method.
Am I wrong? What is the real difference?