You love Ruby.
A beautiful language, object orientated with a light sprinkling of functional features.
The community is nice.
But there’s a nagging doubt in the back of your mind.
Real Rubyists use tests
TDD, BDD, RSpec, Capybara …
you’re not a rubyist if you don’t write tests.
That’s what the cool kids say.
And whenever you try to write a test …
my mind just goes blank, I have no idea what to write
Write a test, watch it go red, write some code, watch it go green, refactor and retire to a tropical island.
That’s the plan right?
But you just can’t get over that first stage.
An empty file.
Your fingers poised over the keyboard.
Your mind a blank.
Why can’t it be like writing “real” code? You always know what to do then.
In fact the code just flows out of you when you’re writing your actual classes and tying them together.
And there’s your answer.
Ruby was designed to make you happy. Not drown you in frustration.
So write those classes. Link them together. Define the message flows.
Then write a test around it.
You know what the test is going to look like, because you can see the code it’s testing.
So write that test and watch it pass.
And here’s the secret … now make it fail.
Take some lines in your actual code and comment them out.
Your test should fail.
If it doesn’t, then your test isn’t testing what you think it’s testing. So update the test and watch it go red.
Then you can safely restore the commented out lines, safe in the knowledge that you have some correctly functioning code and a test that proves it.