Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
Hi Lucky,
Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
Mocks are objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
just go through following link.
http://rspec.rubyforge.org/rspec/1.1.12/classes/Spec/Mocks.html
http://www.martinfowler.com/articles/mocksArentStubs.html#TheDifferenceBetweenMocksAndStubs
I hope this will help you.
Cheerrsss!! -Ganesh K
Hi , Am new to Rspec.Can anybody tell the difference between mock and stub. In which scenarios we use these
