DEV Community

Discussion on: Don't Mock What You Don't Own

Collapse
 
satansdeer profile image
Maksim Ivanov

Thanks for the comment.

You have a very good point. I've introduced a test that is tightly coupled to CarrierWave here, which made it kind of integration tests (which I didn't originally intend to do).

So here I've described that mocking would be even worse idea.

But I agree that the better solution would be to have a wrapper.

This article describes not so recent events, but I'll research the possibility of wrapping CarrierWave and ActiveRecord for my future projects.

Collapse
 
markschweiger15 profile image
Mark Schweiger

I agree with Paweł.
From my experience, avoiding mocks on some tests turns them into integration tests and that's not always the goal when doing TDD.
I do like the idea of having wrappers, but that doesn't reduce the need for mocking completely when dealing with 3rd party libs.

Great article!