#= require "./helper" describe "The Luca Framework", -> it "should specify a version", -> expect(Luca.VERSION).toBeDefined() it "should define Luca in the global space", -> expect(Luca).toBeDefined() it "should enable bootstrap by default", -> expect(Luca.enableBootstrap).toBeTruthy() it "should have classes in the registry", -> expect( Luca.registry.classes ).toBeDefined() it "should be able to lookup classes in the registry by ctype", -> expect( Luca.registry.lookup("form_view") ).toBeTruthy() it "should allow me to add view namespaces to the registry", -> Luca.registry.addNamespace("Test.namespace") expect( Luca.registry.namespaces ).toContain("Test.namespace") it "should resolve a value.string to the object", -> window.nested = value: string: "haha" value = Luca.util.nestedValue("nested.value.string", window) expect(value).toEqual("haha") it "should create an instance of a class by ctype", -> object = ctype: "template" template: "components/form_view" component = Luca.util.lazyComponent(object) expect( _.isFunction(component.render) ).toBeTruthy() it "should find a created view in the cache", -> template = new Luca.components.Template template: "components/form_view" name: 'test_template' expect(Luca.cache("test_template")).toBeDefined() it "should detect if an object is probably a backbone view", -> obj = render: sinon.spy() el: true expect( Luca.isBackboneView(obj) ).toEqual true expect( Luca.isBackboneView({}) ).toEqual false it "should detect if an object is probably a backbone collection", -> obj = fetch: sinon.spy() reset: sinon.spy() expect( Luca.isBackboneCollection(obj) ).toEqual true expect( Luca.isBackboneCollection({}) ).toEqual false it "should detect if an object is probably a backbone model", -> obj = set: sinon.spy() get: sinon.spy() attributes: {} expect( Luca.isBackboneModel(obj) ).toEqual true expect( Luca.isBackboneModel({}) ).toEqual false describe