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