Blog post using TDD as example

Hi guys,

I’m writing a blog post about something related to Active Model, but I want to do it using TDD (because it is how I’m used to do). The problem is that it is hard to follow the TDD process in a blog post.
Can you give some tips and references of how to do it ?

Your instincts about red-green-refactor being hard to follow in a blog post that’s not about TDD itself is correct.

I think that doing the step-by-step process of TDD is really valuable when you are trying to make a point about TDD (and definitely good practice while you’re working), but I think it can make for a distracting blog post if you are trying to cover another topic. I would post your tests at the beginning or end of the post (alongside the code, so maybe final code and final tests?), to show some of your testing chops, but I would focus the meat of your post on ActiveModel.

ActiveModel is a great topic, look forward to seeing the post!

1 Like

Thanks @geoffharcourt, you got the points that was bugging me.
Your approach is a better idea, since it is not about TDD. I’ll share it with you as soon as I finish :smile:

Take a look at Jose Valims Crafting Rails Applications book, its a great example of illustrating concepts with TDD woven in.