I’ve been using TDD for most of my new projects. I found that when I start writing tests for my code, I naturally break it up into testable chunks as seen in the post. Testing EmailSubscriptionWorker is much more robust than mocking the MailChimp object when testing User.subscribe_to_mailchimp and makes a lot more sense.
This seems like the same natural evolution I see in my code.
Is there something wrong with starting with the naive approach?
Seems like if I started with the final product, I might waste time writing code if we decide that an email marketing feature was un-necessary.
I’ve been using TDD for most of my new projects. I found that when I start writing tests for my code, I naturally break it up into testable chunks as seen in the post. Testing
EmailSubscriptionWorker
is much more robust than mocking the MailChimp object when testingUser.subscribe_to_mailchimp
and makes a lot more sense.