This exercise/assessment is used in the first couple of lessons where we focus on applying Ruby.
Command line applications are pretty hard to test for reasons that are vague and abstract:
- standard in/out streaming
- dependency injection
We have taken that pain away from you in this project. A class is written with
the application logic at /lib/todos.rb. The run method is where you should
add your logic.
There is only one test file. See your first test fail with rspec. Write the code
in run to make it pass. Change the xit test method to it to get the next
test failing. Pay attention to the failure message, and make it pass. Rinse and
repeat.
Command line version of the app can be run at any time from the root of the project
with ruby todo_cli.rb.
It only comes with the 'rspec' gem for testing. It also comes with files that set the ruby version and the gemset. Once you pull down this project once, and bundle gems, you shouldn't have to do it again. Your computer should just know which Ruby and gemset to use.
bundleto get your gems- Tests are written
- CLI apps are hard to test. We have built a tiny stub of a class to help. Put your code in the Todos#run method!
- run tests with
rspecand make each one pass - run the command line app with
ruby todo_cli.rb