Recently I found ruby-koans on github. If I should discribe it in a few words I would say it’s a test driven ruby tutorial.
After downloading ruby-koans you call rake and you see the first failing test.
test_assert_truth has damaged your karma.You have not yet reached enlightenment …
<false> is not true.
Please meditate on the following code:
Then you take a look at the test-file
# We shall contemplate truth by testing reality, via asserts.
assert false # This should be true
end# Enlightenment may be more easily achieved with appropriate
assert false, „This should be true — Please fix this“
# To understand reality, we must compare our expectations against
expected_value = __
actual_value = 1 + 1
assert expected_value == actual_value
By correcting the tests you learn much about ruby and tests – step by step.
Like meta programming in ruby this is a meta-way in learning ruby.