require 'rubygems' require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'martin/base' class Test::Unit::TestCase end class Calculator def add(*nums) nums.reduce(:+) end end class CLI < Martin::Base def CLI.answer; @answer; end configure do @calc = Calculator.new end command /add (\d+) to (\d+)/ do |a, b| @answer = @calc.add(a.to_i, b.to_i) end error do |input| @answer = 'Error' end end