With the Edgecase Ruby Koans Online
Ruby Koans Online
The Ruby Koans are a great way to learn about the Ruby language.
This Ruby Koans Online is an abridged version of the Koans in the convenience of a browser.
However, if this is your first time through the Koans, we recommend you read the introduction below to find out how the Koans work.
Start the Koans >>
The Koans World
The koans are broken out into areas covering such topics as hashes, modules and classes. Each of these are presented on their own page. Each koan builds up your knowledge of Ruby and builds upon itself.
The Path to Enlightenment
Each page consists of a number of tests that you have to complete and any information you might require to help you make those test pass. You can run the tests by clicking the Meditate button at any time or by pressing the Enter key when filling in any of the tests.
Red, Green, Refactor
In test-driven development (TDD) the mantra has always been
write a failing test and run it,
write just enough code to make the test pass, and
look at the code to see if you can make it any better.
With the Ruby Koans Online,
the tests will start in the failing state (background is red)
type what you expect the result(s) to be in the input box(es) provided to make the test pass ( background becomes green)
then take a moment to reflect upon the test to see what it is teaching you and, if required, improve the code to better communicate its intent (refactor)
The happy path
For example, type true in the input box below and then click the Meditate button or hit Enter to turn the box green.
Straying from the path
If the results were not what you expected, the Koans will guide you back to the enlightened path with a hint.
Type false in the box below to see the hint displayed.
Wait, but it said it expected false! What gives!?
The wording comes from the TestUnit framework.
In TDD you will write a test with an expectation of how you want the code to behave and then write the actual code to make that test pass.
This might seem confusing in the case of the Ruby Koans, where most of the test is usually written for you.
In Koans you are providing what your
expectation is, so the test framework reports your
expectations vs actual results.
In Chrome, hitting the browser back button from the Koans error page will cause the browser to move some of your answers around. Either don't use Chrome or refresh the page after hitting your browser back button to get Chrome to put your answers in their proper places. Documented Issue
If you encounter any other issues whilst using the Ruby Koans Online, please contact us using the Contact button at the top right of the window.
Thanks, the Ruby Koans Online Team
Start the Koans >>