Sha256: 694a454b5253f22b0de62bfd41fadedbfcf0ef5fba3cced69b27dcf1c31fc52d
Contents?: true
Size: 1.36 KB
Versions: 43
Compression:
Stored size: 1.36 KB
Contents
describe("NewPingView", function(){ beforeEach(function(){ var session = new Session(); session.setAuthenticated('true'); session.setApiKey('testtoken'); }); afterEach(function(){ var session = new Session(); session.setAuthenticated('false'); session.setApiKey(null); }); it("should have render initial html with name",function(){ sinon.stub(jQuery,'ajax'); var user = new User(); user.set('name','testname'); this.newPingView = new App.Views.NewPing({model : user}); this.PingRenderSpy = sinon.spy(this.newPingView,'render'); this.newPingView.render(); expect(this.PingRenderSpy).toHaveBeenCalledOnce(); jQuery.ajax.restore(); }); it("should have render initial html with no name",function(){ sinon.stub(jQuery,'ajax'); var user = new User(); sinon.stub(user,'get_users'); this.newPingView = new App.Views.NewPing({model : user}); this.PingRenderSpy = sinon.spy(this.newPingView,'render'); this.newPingView.render(); expect(this.PingRenderSpy).toHaveBeenCalledOnce(); user.get_users.restore(); jQuery.ajax.restore(); }); it("should have correct html rendered ",function(){ sinon.stub(jQuery,'ajax'); var user = new User(); this.newPingView = new App.Views.NewPing({model : user}); var title = this.newPingView.el.innerHTML.search('Ping User/s'); expect(title).toBeGreaterThan(0); jQuery.ajax.restore(); }) });
Version data entries
43 entries across 43 versions & 1 rubygems