Do controllers need unit tests if they're covered by integration test?

Do we need to do unit tests for controllers when we do integration tests?
Or the integration is enough ?

I usually skip unit tests for controllers when they’re covered by integration tests.

One exception is that I’ll sometimes test things like ā€œmake sure logged-out users can’t see thisā€, or ā€œmake sure a user can’t see another user’s private messagesā€ with controller tests. It’s sometimes easier to test them directly this way, rather than exercising the whole app stack.

5 Likes