AMBARI-8818. Fix Failed UI Unit tests (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a9757664 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a9757664 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a9757664 Branch: refs/heads/trunk Commit: a975766419827ac2a65c43575cc5256fac2221aa Parents: 9caa2bb Author: Alex Antonenko <[email protected]> Authored: Fri Dec 19 20:25:28 2014 +0200 Committer: Alex Antonenko <[email protected]> Committed: Fri Dec 19 20:25:28 2014 +0200 ---------------------------------------------------------------------- ambari-web/test/controllers/wizard/step3_test.js | 11 ++++++----- ambari-web/test/views/main/menu_test.js | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a9757664/ambari-web/test/controllers/wizard/step3_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js index 522f60b..73a9ff3 100644 --- a/ambari-web/test/controllers/wizard/step3_test.js +++ b/ambari-web/test/controllers/wizard/step3_test.js @@ -582,7 +582,7 @@ describe('App.WizardStep3Controller', function () { describe('#setRegistrationInProgressOnce', function() { before(function(){ - sinon.spy(Em.run, 'once'); + sinon.stub(Em.run, 'once', Em.K); }); after(function(){ Em.run.once.restore(); @@ -1667,17 +1667,18 @@ describe('App.WizardStep3Controller', function () { }); beforeEach(function () { - sinon.spy(App.router.get('installerController'), 'launchBootstrap'); + sinon.stub(App.router.get('installerController'), 'launchBootstrap', Em.K); + this.mock = sinon.stub(App, 'get'); }); afterEach(function () { - App.router.get('installerController.launchBootstrap').restore(); - App.get.restore(); + App.router.get('installerController').launchBootstrap.restore(); + this.mock.restore(); }); cases.forEach(function (item) { it(item.title, function () { - sinon.stub(App, 'get').withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount); + this.mock.withArgs('supports.customizeAgentUserAccount').returns(item.customizeAgentUserAccount); controller.setupBootStrap(); expect(App.router.get('installerController.launchBootstrap').firstCall.args[0]).to.equal(JSON.stringify({ verbose: true, http://git-wip-us.apache.org/repos/asf/ambari/blob/a9757664/ambari-web/test/views/main/menu_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/menu_test.js b/ambari-web/test/views/main/menu_test.js index 6d56526..53c58c7 100644 --- a/ambari-web/test/views/main/menu_test.js +++ b/ambari-web/test/views/main/menu_test.js @@ -28,25 +28,25 @@ describe('App.MainMenuView', function () { beforeEach(function () { supportsMirroring = Em.get('App.supports.mirroring'); Em.set('App.supports.mirroring', false); - sinon.stub(App, 'get').returns(false); + this.mock = sinon.stub(App, 'get'); sinon.stub(App.router, 'get') .withArgs('clusterController.isLoaded').returns(true) .withArgs('loggedIn').returns(true); }); afterEach(function () { Em.set('App.supports.mirroring', supportsMirroring); - App.get.restore(); + this.mock.restore(); App.router.get.restore(); }); it('menu should be populated if cluster installation is completed', function () { - App.get.withArgs('router.clusterInstallCompleted').returns(true); + this.mock.withArgs('router.clusterInstallCompleted').returns(true); App.router.notifyPropertyChange('clusterInstallCompleted'); expect(mainMenuView.get('content').length > 1).to.be.true; }); it('menu should not be populated if cluster installation is not completed', function () { - App.get.withArgs('router.clusterInstallCompleted').returns(false); + this.mock.withArgs('router.clusterInstallCompleted').returns(false); App.router.notifyPropertyChange('clusterInstallCompleted'); expect(mainMenuView.get('content').length > 1).to.be.false; });
