This is a fork of http://testfirst.org/
Make sure to use a current version of ruby, at least ruby 3.4.
-
download this repos as a zip file
-
unpack the zip file
-
inside the folder run
bundle install
Video: Setup for Windows and WSL - german only
The goal of this exercise is to learn about the main features of Ruby. There are tests given, you fulfill the tests by writing very short programs.
Recommended: do all the exercises, including extra credit. But beware: the problems get exponentially harder!
Recommended: switch off all AI coding assistents. this is about exercising your own brain!
Each folder contains a lesson about some aspect of ruby. So for each folder do the following:
- on the command line: change into the subfolder, there you will find a *_spec.rb file containing the test. sometimes there are hints in this file.
- run
bundle exec rake
→ you will get an error saying that a file (for examplehello.rb
) is missing - create the missing file, run
rake
again → you will get an error saying that a specific function (for examplehello
) does not return an expected value - in file hello.rb write an implementation for the function, run
rake
again - maybe the test is now green. maybe not. improve your implementation until the test is green. - now and again run
rubocop
to see recommendations on coding conventions, orrubocop -a
to automatically apply them to your code - once you are satisfied with your solution: commit to branch a1
- in file NOTES.md write up what you learned about ruby. compare ruby to other languages you know, put references to documentation or stack overflow articles here. If you keep your own programming lab book in another format than markdown, feel free to use that format.
repeat for the other tests and other folders.
when you are finished you should have a lot of running tests, a basic understanding and a lot of notes on Ruby.