Chapter 16. Time Recording

Imagine your team or department uses a tool to track the hours spent on client projects so that your company can invoice correctly at the end of each month.[1] The tool is a Ruby script offering a simple command-line interface; it’s used like this (the last argument is always a project name, and -u selects a user):

[1] The source code for this example is at http://github.com/kevinrutherford/rrwb-code.

image

Here is the script itself:

image

The script also has a few end-to-end tests:

Notice that the script stores the record ...

Get Refactoring in Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.