Sha256: f1fa526436c83d19e8a68909c4f72b9a8e6639dde178f79535347361cb616492
Contents?: true
Size: 1.13 KB
Versions: 36
Compression:
Stored size: 1.13 KB
Contents
describe("Index", function(){ beforeEach(function(){ this.indexView = new App.Views.Index; }); afterEach(function(){ var session = new Session(); session.setAuthenticated('false'); session.setApiKey(null); }) it("should have render initial html",function(){ this.indexRenderSpy = sinon.spy(this.indexView,'render'); this.indexView.render(); expect(this.indexRenderSpy).toHaveBeenCalledOnce(); }); it("should call login and set auth",function(){ this.indexLoginSpy = sinon.spy(this.indexView,'login') var stub = sinon.stub(jQuery,'ajax').yieldsTo("success","testtoken"); function myevent(){ this.preventDefault=function(){return true;} } e = new myevent(); this.indexView.login(e); var session = new Session(); expect(session.getAuthenticated()).toEqual('true') expect(session.getApiKey()).toEqual('testtoken') jQuery.ajax.restore(); }); it("should have correct html rendered",function(){ var login = this.indexView.el.innerHTML.search('Login'); expect(login).toBeGreaterThan(0); var password = this.indexView.el.innerHTML.search('Password'); expect(password).toBeGreaterThan(0); }) });
Version data entries
36 entries across 36 versions & 1 rubygems