use define_method to DRY up code, make test less brittle
DRY up tests; add commitratio