1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00
paloma/test_app/spec/javascripts/router_spec.js
2014-02-15 15:11:27 +08:00

52 lines
No EOL
1.2 KiB
JavaScript

describe('Paloma.Router', function(){
var delimiter = '/',
router = new Paloma.Router(delimiter);
describe('#parse(path)', function(){
describe('when path has a namespace', function(){
var result;
beforeEach(function(){
result = router.parse('Foo/Bar/Baz/Controller');
});
it('returns the array of the namespaces', function(){
expect(result.namespaces).toEqual(['Foo', 'Bar', 'Baz']);
});
it('returns the controller', function(){
expect(result.controller).toEqual('Controller');
});
it('returns the controllerPath', function(){
expect(result.controllerPath).toEqual(['Foo', 'Bar', 'Baz', 'Controller']);
});
});
describe('when path has no namespace', function(){
var result;
beforeEach(function(){
result = router.parse('Controller');
});
it('returns an empty array of namespaces', function(){
expect(result.namespaces).toEqual([]);
});
it('returns the controller', function(){
expect(result.controller).toEqual('Controller');
});
it('returns the controllerPath', function(){
expect(result.controllerPath).toEqual(['Controller']);
});
});
});
});