Let's say I have a function (written in Ruby, but should be understandable by everyone):
def am_I_old_enough?(name = 'filip') person = Person::API.new(name) if person.male? return person.age > 21 else return person.age > 18 end end In unit testing I would create four tests to cover all scenarios. Each will use mocked Person::API object with stubbed methods male? and age.
Now it comes to writing integration tests. I assume that Person::API should not be mocked any more. So I would create exactly the same four test cases, but without mocking Person::API object. Is that correct?
If yes, then what's the point of writing unit tests at all, if I could just write integration tests which give me more confidence (as I work on real objects, not stubs or mocks)?