Sha256: 417b32cb86bc9a3010ae95137be7db77e89f6e33c43a89d04d4b0c34c6bc1b67
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
describe("ShowUserView", function(){ beforeEach(function(){ var session = new Session(); session.setAuthenticated('true'); session.setApiKey('testtoken'); user = new User(); user.set('name','testname'); source = new Source(); sinon.stub(jQuery,'ajax') sinon.stub(source,'fetch') this.showUserView = new App.Views.ShowUser({model : user}); }); afterEach(function(){ var session = new Session(); session.setAuthenticated('false'); session.setApiKey(null); jQuery.ajax.restore(); }); it("should have render initial html",function(){ this.showUserSpy = sinon.spy(this.showUserView,'render'); this.showUserView.render(); expect(this.showUserSpy).toHaveBeenCalledOnce(); }); it("should delete user",function(){ this.deleteUserDeleteSpy = sinon.spy(this.showUserView,'delete_user'); function myevent(){ this.preventDefault=function(){return true;} } e = new myevent(); this.showUserView.delete_user(e); expect(this.deleteUserDeleteSpy).toHaveBeenCalledOnce(); }); it("should have correct html rendered ",function(){ var title = this.showUserView.el.innerHTML.search("User: testname"); expect(title).toBeGreaterThan(0); }) });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rhoconnect-3.2.0.beta1 | spec/javascripts/show_user_view_spec.js |