Flexible mocking for Ruby testing