console.logの出力結果のテストってどうやってるんだろう?

実際にはテストしやすいように出力する部分と出力する内容を分離すればいいんだけど、直接出力する場合ってどうやってるんだろうか?

var QUnit = require('path/to/qunit-helper').QUnit;

var response = {};
response.log = function log () {
    console.log(
        (new Date).toUTCString()
      , this.method.toUpperCase()
      , this.pathname
      , this.statusCode.toString()
    );
};


QUnit.module('response.log()', {
    setup: function () {
        this.test = function (method, pathname, statusCode) {
            console.log = function () {
                var arg = arguments;
                equal(arg[0], (new Date).toUTCString(), arg[0]);
                equal(arg[1], method.toUpperCase(),  arg[1]);
                equal(arg[2], pathname, arg[2]);
                equal(arg[3], statusCode.toString(),  arg[3]);
            };

            response.method   = method;
            response.pathname = pathname;
            response.statusCode = statusCode;

            response.log();
        }
    }
});
test('response.log', function () {
    this.test('get', '/log', 200);
});