Sha256: cab56a5fb052f47dca119181565b38186ab114e0258a403b23ac25a5bba7a590

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

describe("EditUserView", function(){
	
	beforeEach(function(){
		var session = new Session();
		session.setAuthenticated('true');
		session.setApiKey('testtoken');
		this.editUserView = new App.Views.EditUser();
	});
	
	afterEach(function(){
		var session = new Session();
		session.setAuthenticated('false');
		session.setApiKey(null);
	});
	
	it("should have render initial html",function(){
		this.UserRenderSpy = sinon.spy(this.editUserView,'render');
			
		this.editUserView.render();
		expect(this.UserRenderSpy).toHaveBeenCalledOnce();
	});
	
	it("should call edit",function(){
		this.editUserRenderSpy = sinon.spy(this.editUserView,'edit');
		sinon.stub(jQuery,'ajax').yieldsTo("success");
		function myevent(){
			this.preventDefault=function(){return true;}
		}
		e = new myevent();
		
		this.editUserView.edit(e);
		expect(this.editUserRenderSpy).toHaveBeenCalledOnce();
		jQuery.ajax.restore();
	});
	
	it("should have correct html rendered ",function(){
		var title = this.editUserView.el.innerHTML.search('Change Admin Password');
		expect(title).toBeGreaterThan(0);
		
		var password = this.editUserView.el.innerHTML.search('Password');
		expect(password).toBeGreaterThan(0);
		
	})
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rhoconnect-3.3.1.beta2 spec/javascripts/edit_user_view_spec.js
rhoconnect-3.2.1 spec/javascripts/edit_user_view_spec.js
rhoconnect-3.2.0 spec/javascripts/edit_user_view_spec.js
rhoconnect-3.2.0.beta5 spec/javascripts/edit_user_view_spec.js
rhoconnect-3.2.0.beta4 spec/javascripts/edit_user_view_spec.js
rhoconnect-3.2.0.beta3 spec/javascripts/edit_user_view_spec.js
rhoconnect-3.2.0.beta2 spec/javascripts/edit_user_view_spec.js