I would use a mock object, if using a real object is impractical / not necessary. Say, for example, you need to call some remote API, such as address search by zip code. You probably want to make fun of the object, so calls to it are not actually executed every time you run your tests. There are other reasons, such as improved speed, requesting data that changes where you need the exact answer, or perhaps it does not exist. This allows you to test the objects individually, since you can determine that when you call these methods on this mock object, you will get it back, and you really do not need to run the code, since this is not important for this test.
If you use devices, you will have a real object, and methods, etc. will be called, and their code will be launched, unless, of course, you drown the methods, something for another question.
Hope this helps. There is a good peepcode ( http://peepcode.com/products/rspec-mocks-and-models ) for mockery and knocking, maybe check this out.
tsdbrown
source share