← Back to Upcase

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


(Ronaldo Yoshio Teruia) #1

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


(Ben Orenstein) #2

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.