Sha256: e12d57fb797151262f3b31072e3876c1de722f89f386c75a76a54d1ea1e7660a

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

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']);
      });
    });

  });

});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paloma-4.2.1 test_app/spec/javascripts/router_spec.js
paloma-4.2.0 test_app/spec/javascripts/router_spec.js
paloma-4.1.2 test_app/spec/javascripts/router_spec.js
paloma-4.1.1 test_app/spec/javascripts/router_spec.js
paloma-4.1.0 test_app/spec/javascripts/router_spec.js
paloma-4.0.0 test_app/spec/javascripts/router_spec.js