These exercises are designed to complement the Ruby Basic lessons on The Odin Project. Each folder contains exercises and specs (tests) for the lessons in the Ruby Basics section.
- First change directory into the lesson directory, for example
cd 1_data_types
. - Run the tests for an exercise file, for example
rspec spec/numbers_exercises_spec.rb
. The first test will fail and the rest will be skipped. - Open that corresponding exercise file in your text editor, in this case the
exercises/numbers_exercises.rb
file. - Write the code to get the failing test to pass in the exercise file and run the tests again to verify it passes.
- Each
exercises
folder has a correspondingspec
folder with matching test files. For instance, you can find the tests forexercises/numbers_exercises.rb
inspec/numbers_exercises_spec.rb
. Find and open the matching spec file. - Unskip the next test by removing the
x
fromxit
. - Run your tests again
rspec spec/numbers_exercises_spec.rb
the second test should now be failing. - Repeat the steps from step 2 until no more tests are skipped and all are passing.
TIP: When there is only one exercise file in a directory (such as in 6_arrays
) you can omit the path to the file and just enter rspec
to run the tests in that file.
- Numbers Exercises
- Strings Exercises
- Array Exercises
- Hash Exercises
- Method Exercises
- Debugging Exercises
- Basic Enumerable Exercises
- Predicate Enumerable Exercises
- Nested Collection Exercises