Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
Allow specifying controller with absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
lalau committed Aug 31, 2012
1 parent 66b2c44 commit 1c57820
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/interface/arrow.js
Expand Up @@ -7,6 +7,7 @@
*/

var log4js = require("log4js");
var path = require("path");

function Arrow(config, args) {
this.logger = log4js.getLogger("Arrow");
Expand Down Expand Up @@ -39,7 +40,7 @@ Arrow.prototype.runController = function (controllerName, testConfig, testParams

if (controllerName) {
if (controllerName.indexOf(".js") !== -1) {
controllerName = process.cwd() + "/" + controllerName;
controllerName = path.resolve(process.cwd(), controllerName);
} else {
controllerName = this.config["arrowModuleRoot"] + "lib/controller/" + controllerName;
}
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/lib/interface/arrow-tests.js
Expand Up @@ -12,6 +12,7 @@ YUI.add('arrow-tests', function (Y, NAME) {
Arrow = require(arrowRoot + '/lib/interface/arrow'),
StubDriver = require(arrowRoot + '/tests/unit/stub/driver.js');
controllerName = 'tests/unit/stub/controller.js';
controllerNameAbsolute = path.join(arrowRoot, controllerName);
suite = new Y.Test.Suite(NAME),
A = Y.Assert;

Expand All @@ -37,6 +38,15 @@ YUI.add('arrow-tests', function (Y, NAME) {
});

A.isTrue(executed, 'Should have executed controller');

executed = false;
arrow.runController(controllerNameAbsolute, {}, {param: "value"}, driver, function (errMsg, data, controller) {
executed = true;
A.isTrue(!errMsg, 'Should have successfully executed controller');
A.areEqual(controller.testParams.param, "value", "Controller should get the parameter");
});

A.isTrue(executed, 'Should have executed controller');
},

'test error controller': function () {
Expand Down

0 comments on commit 1c57820

Please sign in to comment.