You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/12/23 19:06:52 UTC

[3/3] ambari git commit: AMBARI-14488. Improve Ambari UI UT (p.1) (onechiporenko)

AMBARI-14488. Improve Ambari UI UT (p.1) (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8acfcd89
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8acfcd89
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8acfcd89

Branch: refs/heads/trunk
Commit: 8acfcd8921ed89328eee060ee7b1383f2d35eb0e
Parents: 6f8b840
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Dec 23 18:11:20 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Dec 23 20:06:29 2015 +0200

----------------------------------------------------------------------
 .../kdc_credentials_controller_mixin_test.js    |  64 ++--
 .../test/mixins/common/reload_popup_test.js     |  39 ++-
 .../common/table_server_view_mixin_test.js      | 124 +++++---
 .../test/mixins/common/widget_mixin_test.js     |   2 +-
 .../common/widgets/export_metrics_mixin_test.js |  57 +++-
 .../common/widgets/widget_section_test.js       |   6 +-
 .../wizard/wizardProgressPageController_test.js |  69 +++--
 ambari-web/test/models/cluster_states_test.js   |  13 +-
 .../test/models/configs/config_group_test.js    |  28 +-
 .../configs/service_config_version_test.js      |   2 +-
 ambari-web/test/router_test.js                  |  27 +-
 ambari-web/test/utils/ajax/ajax_test.js         |  20 +-
 ambari-web/test/utils/blueprint_test.js         |  22 +-
 ambari-web/test/utils/config_test.js            | 307 +++++++++++++------
 .../utils/configs/config_initializer_test.js    |  41 ++-
 .../test/utils/host_progress_popup_test.js      |   5 +-
 ambari-web/test/utils/ui_effects_test.js        |  11 +-
 .../test/views/common/chart/linear_time_test.js |   2 +-
 .../common/configs/config_history_flow_test.js  | 147 ++++++---
 .../notification_configs_view_test.js           |  64 ++--
 .../service_configs_by_category_view_test.js    |  21 +-
 .../widgets/list_config_widget_view_test.js     |  27 +-
 .../widgets/slider_config_widget_view_test.js   | 228 ++++++++++----
 .../widgets/toggle_config_widget_view_test.js   |  43 +--
 .../test/views/common/controls_view_test.js     | 168 ++++++----
 .../test/views/common/custom_date_popup_test.js |  69 +++--
 .../views/common/filter_combo_cleanable_test.js |  10 +-
 .../form/manage_kdc_credentials_form_test.js    |  87 ++++--
 .../test/views/common/modal_popup_test.js       |  11 +-
 .../modal_popups/cluster_check_popup_test.js    |  53 +++-
 .../modal_popups/hosts_table_list_popup_test.js |  30 +-
 .../common/widget/graph_widget_view_test.js     |  59 ++--
 .../main/admin/stack_upgrade/menu_view_test.js  |   7 +-
 .../admin/stack_upgrade/version_view_test.js    |  14 +-
 ambari-web/test/views/main/admin_test.js        |   6 +-
 .../main/charts/heatmap/heatmap_host_test.js    | 211 +++++++++----
 .../test/views/main/dashboard/widget_test.js    |  23 +-
 .../dashboard/widgets/datanode_live_test.js     |  10 +-
 .../host_component_views/datanode_view_test.js  |   6 +
 ambari-web/test/views/main/host/menu_test.js    |   9 +-
 ambari-web/test/views/main/menu_test.js         |   8 +-
 .../ambari_metrics/regionserver_base_test.js    |  63 ++--
 .../views/main/service/info/summary_test.js     | 278 ++++++++++-------
 ambari-web/test/views/wizard/step0_view_test.js |  12 +-
 .../test/views/wizard/step10_view_test.js       |  11 +-
 ambari-web/test/views/wizard/step1_view_test.js |  73 +++--
 .../step3/hostWarningPopupBody_view_test.js     | 131 +++++---
 ambari-web/test/views/wizard/step3_view_test.js |  23 +-
 ambari-web/test/views/wizard/step5_view_test.js |  21 +-
 ambari-web/test/views/wizard/step6_view_test.js |  14 +-
 ambari-web/test/views/wizard/step8_view_test.js |  22 +-
 .../wizard/step9/hostLogPopupBody_view_test.js  | 210 ++++++++-----
 ambari-web/test/views/wizard/step9_view_test.js |  48 ++-
 53 files changed, 2081 insertions(+), 975 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
index 9f05cef..edfed5f 100644
--- a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
+++ b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
@@ -70,6 +70,26 @@ describe('App.KDCCredentialsControllerMixin', function() {
   });
 
   describe('#createKDCCredentials', function() {
+
+    beforeEach(function () {
+      sinon.stub(App, 'get').withArgs('clusterName').returns('testName');
+      sinon.stub(credentialsUtils, 'createCredentials', function() {
+        return resolveWith();
+      });
+      sinon.stub(credentialsUtils, 'updateCredentials', function() {
+        return resolveWith();
+      });
+      mixedObject.reopen({
+        isStorePersisted: true
+      });
+    });
+
+    afterEach(function () {
+      App.get.restore();
+      credentialsUtils.createCredentials.restore();
+      credentialsUtils.updateCredentials.restore();
+    });
+
     var createConfig = function(name, value) {
       return App.ServiceConfigProperty.create({
         name: name,
@@ -164,36 +184,36 @@ describe('App.KDCCredentialsControllerMixin', function() {
         message: 'Save Admin credentials checkbox unchecked, credentials already stored and should be updated as `temporary`'
       }
     ].forEach(function(test) {
-      it(test.message, function() {
-        sinon.stub(App, 'get').withArgs('clusterName').returns('testName');
-        sinon.stub(credentialsUtils, 'getCredential', function(clusterName, alias) {
-          return test.credentialsExists ? resolveWith() : rejectWith();
+      describe(test.message, function() {
+        beforeEach(function () {
+          sinon.stub(credentialsUtils, 'getCredential', function() {
+            return test.credentialsExists ? resolveWith() : rejectWith();
+          });
+          mixedObject.createKDCCredentials(test.configs);
         });
-        sinon.stub(credentialsUtils, 'createCredentials', function() {
-          return resolveWith();
-        });
-        sinon.stub(credentialsUtils, 'updateCredentials', function() {
-          return resolveWith();
+
+        afterEach(function () {
+          credentialsUtils.getCredential.restore();
         });
 
-        mixedObject.reopen({
-          isStorePersisted: function() {
-            return true;
-          }.property()
+        it('credentialsUtils#createCredentials called', function () {
+          expect(credentialsUtils.createCredentials.calledOnce).to.equal(test.createCredentialFnCalled);
         });
-        mixedObject.createKDCCredentials(test.configs);
-        assert.equal(credentialsUtils.createCredentials.calledOnce, test.createCredentialFnCalled,  'credentialsUtils#createCredentials called');
+
         if (test.createCredentialFnCalled) {
-          assert.deepEqual(credentialsUtils.createCredentials.args[0], test.e, 'credentialsUtils#createCredentials called with correct arguments');
+          it('credentialsUtils#createCredentials called with correct arguments', function () {
+            expect(credentialsUtils.createCredentials.args[0]).to.eql(test.e);
+          });
         }
-        credentialsUtils.createCredentials.restore();
-        assert.equal(credentialsUtils.updateCredentials.calledOnce, test.updateCredentialFnCalled, 'credentialUtils#updateCredentials called');
+        it('credentialUtils#updateCredentials called', function () {
+          expect(credentialsUtils.updateCredentials.calledOnce).to.equal(test.updateCredentialFnCalled);
+        });
+
         if (test.updateCredentialFnCalled) {
-          assert.deepEqual(credentialsUtils.updateCredentials.args[0], test.e, 'credentialUtils#updateCredentials called with correct arguments');
+          it('credentialUtils#updateCredentials called with correct arguments', function () {
+            expect(credentialsUtils.updateCredentials.args[0]).to.eql(test.e);
+          });
         }
-        credentialsUtils.updateCredentials.restore();
-        credentialsUtils.getCredential.restore();
-        App.get.restore();
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/common/reload_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/reload_popup_test.js b/ambari-web/test/mixins/common/reload_popup_test.js
index 7ed0cff..8c6b033 100644
--- a/ambari-web/test/mixins/common/reload_popup_test.js
+++ b/ambari-web/test/mixins/common/reload_popup_test.js
@@ -159,18 +159,33 @@ describe('App.ReloadPopupMixin', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        if (!Em.isNone(item.retryCount)) {
-          obj.set('retryCount', item.retryCount);
-        }
-        obj.reloadErrorCallback.apply(obj, item.args);
-        expect(obj.closeReloadPopup.callCount).to.equal(item.closeReloadPopupCallCount);
-        expect(App.ajax.defaultErrorHandler.callCount).to.equal(item.defaultErrorHandlerCallCount);
-        expect(obj.showReloadPopup.callCount).to.equal(item.showReloadPopupCallCount);
-        expect(window.setTimeout.callCount).to.equal(item.setTimeoutCount);
-        if (!Em.isNone(item.retryCountResult)) {
-          obj.set('retryCount', item.retryCountResult);
-        }
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          if (!Em.isNone(item.retryCount)) {
+            obj.set('retryCount', item.retryCount);
+          }
+          obj.reloadErrorCallback.apply(obj, item.args);
+        });
+
+        afterEach(function () {
+          if (!Em.isNone(item.retryCountResult)) {
+            obj.set('retryCount', item.retryCountResult);
+          }
+        });
+
+        it('closeReloadPopup is called needed number of times', function () {
+          expect(obj.closeReloadPopup.callCount).to.equal(item.closeReloadPopupCallCount);
+        });
+        it('defaultErrorHandler is called needed number of times', function () {
+          expect(App.ajax.defaultErrorHandler.callCount).to.equal(item.defaultErrorHandlerCallCount);
+        });
+        it('showReloadPopup is called needed number of times', function () {
+          expect(obj.showReloadPopup.callCount).to.equal(item.showReloadPopupCallCount);
+        });
+        it('setTimeout is called needed number of times', function () {
+          expect(window.setTimeout.callCount).to.equal(item.setTimeoutCount);
+        });
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/common/table_server_view_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/table_server_view_mixin_test.js b/ambari-web/test/mixins/common/table_server_view_mixin_test.js
index b503ddf..05c5ef4 100644
--- a/ambari-web/test/mixins/common/table_server_view_mixin_test.js
+++ b/ambari-web/test/mixins/common/table_server_view_mixin_test.js
@@ -82,53 +82,99 @@ describe('App.MainConfigHistoryView', function() {
       App.db.setDisplayLength.restore();
     });
 
-    it('displayLength is correct', function() {
-      view.set('displayLength', '50');
-      view.set('startIndex', null);
+    describe('displayLength is correct', function() {
+      beforeEach(function () {
+        view.set('displayLength', '50');
+        view.set('startIndex', null);
+        view.updatePagination();
+      });
 
-      view.updatePagination();
-
-      expect(view.refresh.calledOnce).to.be.true;
-      expect(App.db.setStartIndex.called).to.be.false;
-      expect(App.db.setDisplayLength.calledWith('mainConfigHistoryController', '50')).to.be.true;
-      expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(0);
-      expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('50');
+      it('refresh is called once', function () {
+        expect(view.refresh.calledOnce).to.be.true;
+      });
+      it('setStartIndex is called once', function () {
+        expect(App.db.setStartIndex.called).to.be.false;
+      });
+      it('setDisplayLength is called with correct arguments', function () {
+        expect(App.db.setDisplayLength.calledWith('mainConfigHistoryController', '50')).to.be.true;
+      });
+      it('paginationProps.startIndex = 0', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(0);
+      });
+      it('paginationProps.displayLength = 50', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('50');
+      });
     });
-    it('startIndex is correct', function() {
-      view.set('displayLength', null);
-      view.set('startIndex', 10);
 
-      view.updatePagination();
+    describe('startIndex is correct', function() {
 
-      expect(view.refresh.calledOnce).to.be.true;
-      expect(App.db.setStartIndex.calledWith('mainConfigHistoryController', 10)).to.be.true;
-      expect(App.db.setDisplayLength.called).to.be.false;
-      expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(10);
-      expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('50');
+      beforeEach(function () {
+        view.set('displayLength', null);
+        view.set('startIndex', 10);
+        view.updatePagination();
+      });
+      it('refresh is called once', function () {
+        expect(view.refresh.calledOnce).to.be.true;
+      });
+      it('setStartIndex is called with valid arguments', function () {
+        expect(App.db.setStartIndex.calledWith('mainConfigHistoryController', 10)).to.be.true;
+      });
+      it('setDisplayLength is not called', function () {
+        expect(App.db.setDisplayLength.called).to.be.false;
+      });
+      it('paginationProps.startIndex = 10', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(10);
+      });
+      it('paginationProps.displayLength = 50', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('50');
+      });
     });
-    it('displayLength and startIndex are correct', function() {
-      view.set('displayLength', '100');
-      view.set('startIndex', 20);
 
-      view.updatePagination();
+    describe('displayLength and startIndex are correct', function() {
+      beforeEach(function () {
+        view.set('displayLength', '100');
+        view.set('startIndex', 20);
+        view.updatePagination();
+      });
 
-      expect(view.refresh.calledOnce).to.be.true;
-      expect(App.db.setStartIndex.calledWith('mainConfigHistoryController', 20)).to.be.true;
-      expect(App.db.setDisplayLength.calledWith('mainConfigHistoryController', '100')).to.be.true;
-      expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(20);
-      expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('100');
+      it('refresh is called once', function () {
+        expect(view.refresh.calledOnce).to.be.true;
+      });
+      it('setStartIndex is called with valid arguments', function () {
+        expect(App.db.setStartIndex.calledWith('mainConfigHistoryController', 20)).to.be.true;
+      });
+      it('setDisplayLength is called with valid arguments', function () {
+        expect(App.db.setDisplayLength.calledWith('mainConfigHistoryController', '100')).to.be.true;
+      });
+      it('paginationProps.startIndex = 20', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(20);
+      });
+      it('paginationProps.displayLength = 100', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('100');
+      });
     });
-    it('displayLength and startIndex are null', function() {
-      view.set('displayLength', null);
-      view.set('startIndex', null);
 
-      view.updatePagination();
-
-      expect(view.refresh.calledOnce).to.be.true;
+    describe('displayLength and startIndex are null', function() {
+      beforeEach(function () {
+        view.set('displayLength', null);
+        view.set('startIndex', null);
+        view.updatePagination();
+      });
+      it('refresh is called once', function () {
+        expect(view.refresh.calledOnce).to.be.true;
+      });
+      it('setStartIndex is not called', function () {
       expect(App.db.setStartIndex.called).to.be.false;
+      });
+      it('setDisplayLength is not called', function () {
       expect(App.db.setDisplayLength.called).to.be.false;
+      });
+      it('paginationProps.startIndex = 20', function () {
       expect(view.get('controller.paginationProps').findProperty('name', 'startIndex').value).to.equal(20);
-      expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('100');
+      });
+      it('paginationProps.displayLength = 100', function () {
+        expect(view.get('controller.paginationProps').findProperty('name', 'displayLength').value).to.equal('100');
+      });
     });
   });
 
@@ -137,14 +183,16 @@ describe('App.MainConfigHistoryView', function() {
       sinon.stub(view, 'saveFilterConditions', Em.K);
       sinon.stub(view, 'refresh', Em.K);
       sinon.spy(view, 'updateFilter');
+      this.clock = sinon.useFakeTimers();
     });
     afterEach(function () {
       view.saveFilterConditions.restore();
       view.updateFilter.restore();
       view.refresh.restore();
+      this.clock.restore();
     });
     it('filteringComplete is false', function() {
-      this.clock = sinon.useFakeTimers();
+
 
       view.set('filteringComplete', false);
       view.updateFilter(1, '1', 'string');
@@ -153,7 +201,7 @@ describe('App.MainConfigHistoryView', function() {
       view.set('filteringComplete', true);
       this.clock.tick(view.get('filterWaitingTime'));
       expect(view.updateFilter.calledWith(1, '1', 'string')).to.be.true;
-      this.clock.restore();
+
     });
     it('filteringComplete is true', function() {
       view.set('filteringComplete', true);
@@ -165,7 +213,6 @@ describe('App.MainConfigHistoryView', function() {
     });
 
     it('clear filters - refresh() clears timer', function () {
-      this.clock = sinon.useFakeTimers();
 
       //clear filters simulation
       view.set('filteringComplete', false);
@@ -179,7 +226,6 @@ describe('App.MainConfigHistoryView', function() {
 
       //should not call update filter again
       expect(view.updateFilter.calledOnce).to.be.true;
-      this.clock.restore();
     })
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js b/ambari-web/test/mixins/common/widget_mixin_test.js
index 1c965b8..72c7da8 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -417,7 +417,7 @@ describe('App.WidgetLoadAggregator', function () {
       expect(aggregator.get('requests')).to.not.be.empty;
       expect(window.setTimeout.called).to.be.false;
     });
-    it("timeout started", function () {
+    it("timeout started (2)", function () {
       aggregator.set('timeoutId', null);
       aggregator.get('requests').clear();
       aggregator.add({});

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js b/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
index c08020c..9e91111 100644
--- a/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
+++ b/ambari-web/test/mixins/common/widgets/export_metrics_mixin_test.js
@@ -90,16 +90,28 @@ describe('App.ExportMetricsMixin', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        obj.set('isExportMenuHidden', item.isExportMenuHidden);
-        obj.exportGraphData(item.event);
-        var ajaxParams = App.ajax.send.firstCall.args[0];
-        expect(obj.get('isExportMenuHidden')).to.be.true;
-        expect(App.ajax.send.calledOnce).to.be.true;
-        expect(ajaxParams.name).to.equal('index');
-        expect(ajaxParams.data).to.eql({
-          p: 'v',
-          isCSV: item.isCSV
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          obj.set('isExportMenuHidden', item.isExportMenuHidden);
+          obj.exportGraphData(item.event);
+          this.ajaxParams = App.ajax.send.firstCall.args[0];
+        });
+
+        it('isExportMenuHidden is true', function () {
+          expect(obj.get('isExportMenuHidden')).to.be.true;
+        });
+        it('one request was done', function () {
+          expect(App.ajax.send.calledOnce).to.be.true;
+        });
+        it('request to the valid end-point', function () {
+          expect(this.ajaxParams.name).to.equal('index');
+        });
+        it('ajax-request with correct data', function () {
+          expect(this.ajaxParams.data).to.eql({
+            p: 'v',
+            isCSV: item.isCSV
+          });
         });
       });
     });
@@ -197,13 +209,26 @@ describe('App.ExportMetricsMixin', function () {
     });
 
     cases.forEach(function (item) {
-      it(item.title, function () {
-        obj.exportGraphDataSuccessCallback(item.response, null, item.params);
-        expect(fileUtils.downloadTextFile.callCount).to.equal(item.downloadTextFileCallCount);
+      describe(item.title, function () {
+
+        beforeEach(function () {
+          obj.exportGraphDataSuccessCallback(item.response, null, item.params);
+        });
+
+        it('downloadTextFile was called needed number of times', function () {
+          expect(fileUtils.downloadTextFile.callCount).to.equal(item.downloadTextFileCallCount);
+        });
+
         if (item.downloadTextFileCallCount) {
-          expect(fileUtils.downloadTextFile.firstCall.args[0].replace(/\s/g, '')).to.equal(item.data);
-          expect(fileUtils.downloadTextFile.firstCall.args[1]).to.equal(item.fileType);
-          expect(fileUtils.downloadTextFile.firstCall.args[2]).to.equal(item.fileName);
+          it('data is valid', function () {
+            expect(fileUtils.downloadTextFile.firstCall.args[0].replace(/\s/g, '')).to.equal(item.data);
+          });
+          it('fileType is valid', function () {
+            expect(fileUtils.downloadTextFile.firstCall.args[1]).to.equal(item.fileType);
+          });
+          it('fileName is valid', function () {
+            expect(fileUtils.downloadTextFile.firstCall.args[2]).to.equal(item.fileName);
+          });
         }
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/common/widgets/widget_section_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widgets/widget_section_test.js b/ambari-web/test/mixins/common/widgets/widget_section_test.js
index 53c1395..e6b8bf4 100644
--- a/ambari-web/test/mixins/common/widgets/widget_section_test.js
+++ b/ambari-web/test/mixins/common/widgets/widget_section_test.js
@@ -47,13 +47,17 @@ describe('App.WidgetSectionMixin', function () {
       }
     ];
 
+    beforeEach(function () {
+      this.stub = sinon.stub(App.Service, 'find');
+    });
+
     afterEach(function () {
       App.Service.find.restore();
     });
 
     cases.forEach(function (item) {
       it(item.title, function () {
-        sinon.stub(App.Service, 'find').returns(item.services);
+        this.stub.returns(item.services);
         expect(obj.get('isAmbariMetricsInstalled')).to.equal(item.isAmbariMetricsInstalled);
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
index 84efaf5..18a37cb 100644
--- a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
+++ b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
@@ -86,31 +86,54 @@ describe('App.wizardProgressPageControllerMixin', function() {
       expect(mixedObjectInstance.checkInstalledComponents.calledWith('ZOOKEEPER_SERVER', ['host1'])).to.be.true;
     });
 
-    it('no ZooKeeper Servers installed. install on host1, host2. ajax request should be called with appropriate params', function() {
-      mixedObjectInstance.createComponent('ZOOKEEPER_SERVER', ['host1', 'host2'], 'ZOOKEEPER');
-      var args = App.ajax.send.args[0][0];
-
-      var queryObject = JSON.parse(args.data.data);
-      expect(args.data.hostName).to.be.eql(['host1', 'host2']);
-      expect(queryObject.RequestInfo.query).to.be.eql('Hosts/host_name=host1|Hosts/host_name=host2');
-      expect(queryObject.Body.host_components[0].HostRoles.component_name).to.be.eql('ZOOKEEPER_SERVER');
-      expect(args.data.taskNum).to.be.eql(1);
-      // invoke callback
-      args.sender[args.success].apply(args.sender, [null, null, args.data]);
-      expect(mixedObjectInstance.updateComponent.called).to.be.true;
+    describe('no ZooKeeper Servers installed. install on host1, host2. ajax request should be called with appropriate params', function() {
+      beforeEach(function () {
+        mixedObjectInstance.createComponent('ZOOKEEPER_SERVER', ['host1', 'host2'], 'ZOOKEEPER');
+        this.args = App.ajax.send.args[0][0];
+        this.queryObject = JSON.parse(this.args.data.data);
+      });
+      it('hostName is valid array', function () {
+        expect(this.args.data.hostName).to.be.eql(['host1', 'host2']);
+      });
+      it('RequestInfo.query is valid', function () {
+        expect(this.queryObject.RequestInfo.query).to.be.eql('Hosts/host_name=host1|Hosts/host_name=host2');
+      });
+      it('affected component is valid', function () {
+        expect(this.queryObject.Body.host_components[0].HostRoles.component_name).to.be.eql('ZOOKEEPER_SERVER');
+      });
+      it('taskNum = 1', function () {
+        expect(this.args.data.taskNum).to.be.eql(1);
+      });
+      it('updateComponent is called', function () {
+        // invoke callback
+        this.args.sender[this.args.success].apply(this.args.sender, [null, null, this.args.data]);
+        expect(mixedObjectInstance.updateComponent.called).to.be.true;
+      });
     });
 
-    it('ZooKeeper Client installed on host1. install on host1, host2. ajax request should be called with appropriate params', function() {
-      mixedObjectInstance.createComponent('ZOOKEEPER_CLIENT', ['host1', 'host2'], 'ZOOKEEPER');
-      var args = App.ajax.send.args[0][0];
-      var queryObject = JSON.parse(args.data.data);
-      expect(args.data.hostName).to.be.eql(['host1', 'host2']);
-      expect(queryObject.RequestInfo.query).to.be.eql('Hosts/host_name=host2');
-      expect(queryObject.Body.host_components[0].HostRoles.component_name).to.be.eql('ZOOKEEPER_CLIENT');
-      expect(mixedObjectInstance.onCreateComponent.called).to.be.false;
-      // invoke callback
-      args.sender[args.success].apply(args.sender, [null, null, args.data]);
-      expect(mixedObjectInstance.updateComponent.called).to.be.true;
+    describe('ZooKeeper Client installed on host1. install on host1, host2. ajax request should be called with appropriate params', function() {
+      beforeEach(function () {
+        mixedObjectInstance.createComponent('ZOOKEEPER_CLIENT', ['host1', 'host2'], 'ZOOKEEPER');
+        this.args = App.ajax.send.args[0][0];
+        this.queryObject = JSON.parse(this.args.data.data);
+      });
+      it('hostName is valid array', function () {
+        expect(this.args.data.hostName).to.be.eql(['host1', 'host2']);
+      });
+      it('RequestInfo.query is valid', function () {
+        expect(this.queryObject.RequestInfo.query).to.be.eql('Hosts/host_name=host2');
+      });
+      it('affected component is valid', function () {
+        expect(this.queryObject.Body.host_components[0].HostRoles.component_name).to.be.eql('ZOOKEEPER_CLIENT');
+      });
+      it('onCreateComponent is not called', function () {
+        expect(mixedObjectInstance.onCreateComponent.called).to.be.false;
+      });
+      it('updateComponent is called', function () {
+        // invoke callback
+        this.args.sender[this.args.success].apply(this.args.sender, [null, null, this.args.data]);
+        expect(mixedObjectInstance.updateComponent.called).to.be.true;
+      });
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/models/cluster_states_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/cluster_states_test.js b/ambari-web/test/models/cluster_states_test.js
index 3f12d9f..d8d6adc 100644
--- a/ambari-web/test/models/cluster_states_test.js
+++ b/ambari-web/test/models/cluster_states_test.js
@@ -72,6 +72,7 @@ describe('App.clusterStatus', function () {
   describe('#setClusterStatus', function () {
 
     beforeEach(function() {
+      sinon.stub(App, 'get').withArgs('testMode').returns(false);
       sinon.stub(status, 'postUserPref', function() {
         return $.ajax();
       });
@@ -82,19 +83,7 @@ describe('App.clusterStatus', function () {
       App.get.restore();
     });
 
-    it('should return false in test mode', function () {
-      sinon.stub(App, 'get', function(k) {
-        if (k === 'testMode') return true;
-        return Em.get(App, k);
-      });
-      expect(status.setClusterStatus()).to.be.false;
-    });
-
     it('should set cluster status in non-test mode', function () {
-      sinon.stub(App, 'get', function(k) {
-        if (k === 'testMode') return false;
-        return Em.get(App, k);
-      });
       var clusterStatus = status.setClusterStatus(newValue);
       expect(clusterStatus).to.eql(newValue);
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/models/configs/config_group_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/config_group_test.js b/ambari-web/test/models/configs/config_group_test.js
index a0c42fd..d1ef208 100644
--- a/ambari-web/test/models/configs/config_group_test.js
+++ b/ambari-web/test/models/configs/config_group_test.js
@@ -78,21 +78,31 @@ describe('App.ServiceConfigGroup', function () {
       expect(model.get('availableHosts')).to.be.empty;
     });
 
-    it("cluster hosts not used", function() {
+    describe("cluster hosts not used", function() {
       var host = Em.Object.create({
         id: 'g1',
         hostComponents: [{componentName: 'c1'}]
       });
 
-      model.reopen({
-        isDefault: false,
-        clusterHosts: [host]
+      beforeEach(function () {
+        model.reopen({
+          isDefault: false,
+          clusterHosts: [host]
+        });
+        model.set('parentConfigGroup.hosts', ['g1']);
+      });
+      it('availableHosts is not empty', function () {
+        expect(model.get('availableHosts')).to.be.not.empty;
+      });
+      it('1st host is selected', function () {
+        expect(model.get('availableHosts')[0].get('selected')).to.be.false;
+      });
+      it('1st host components are correct', function () {
+        expect(model.get('availableHosts')[0].get('hostComponentNames')).to.eql(['c1']);
+      });
+      it('1st host `host` is correct', function () {
+        expect(model.get('availableHosts')[0].get('host')).to.eql(host);
       });
-      model.set('parentConfigGroup.hosts', ['g1']);
-      expect(model.get('availableHosts')).to.not.be.empty;
-      expect(model.get('availableHosts')[0].get('selected')).to.be.false;
-      expect(model.get('availableHosts')[0].get('hostComponentNames')).to.eql(['c1']);
-      expect(model.get('availableHosts')[0].get('host')).to.eql(host);
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/models/configs/service_config_version_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/service_config_version_test.js b/ambari-web/test/models/configs/service_config_version_test.js
index a447d6b..fcb0854 100644
--- a/ambari-web/test/models/configs/service_config_version_test.js
+++ b/ambari-web/test/models/configs/service_config_version_test.js
@@ -59,7 +59,7 @@ describe('App.ServiceConfigVersion', function () {
 
   describe("#configGroupName", function() {
 
-    it("default group", function() {
+    it("not default group", function() {
       model.reopen({
         groupName: 'g1',
         isDefault: false

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/router_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/router_test.js b/ambari-web/test/router_test.js
index 456200f..da62895 100644
--- a/ambari-web/test/router_test.js
+++ b/ambari-web/test/router_test.js
@@ -83,6 +83,7 @@ describe('App.Router', function () {
     ];
 
     beforeEach(function () {
+      this.getUser = sinon.stub(App.db, 'getUser');
       App.setProperties({
         isAdmin: false,
         isOperator: false,
@@ -91,12 +92,12 @@ describe('App.Router', function () {
     });
 
     afterEach(function () {
-      App.db.getUser.restore();
+      this.getUser.restore();
     });
 
     cases.forEach(function (item) {
       it(item.title, function () {
-        sinon.stub(App.db, 'getUser').returns(item.user);
+        this.getUser.returns(item.user);
         router.initAdmin();
         expect(App.get('isAdmin')).to.equal(item.isAdmin);
         expect(App.get('isOperator')).to.equal(item.isOperator);
@@ -258,6 +259,7 @@ describe('App.Router', function () {
       expect(App.get('isPermissionDataLoaded')).to.be.true;
       expect(mock.dataLoading.calledOnce).to.be.true;
     });
+
     it("cluster exists, READ privileges", function () {
       var clusterData = {
         items: [{
@@ -448,6 +450,20 @@ describe('App.Router', function () {
   });
 
   describe("#getAuthenticated", function() {
+    var router;
+    beforeEach(function () {
+      router = App.Router.create();
+      this.mockGetCurrentLocationUrl = sinon.stub(router, 'getCurrentLocationUrl');
+      sinon.stub(router, 'redirectByURL', Em.K);
+    });
+
+    afterEach(function () {
+      App.ajax.send.restore();
+      router.getCurrentLocationUrl.restore();
+      router.redirectByURL.restore();
+      this.mockGetCurrentLocationUrl.restore();
+    });
+
     [
       {
         lastSetURL: '/login/local',
@@ -481,7 +497,6 @@ describe('App.Router', function () {
       }
     ].forEach(function(test) {
       it(test.m, function() {
-        var router = App.Router.create();
         var mockCurrentUrl = 'http://localhost:3333/#/some/hash';
         router.set('location.lastSetURL', test.lastSetURL);
         sinon.stub(App.ajax, 'send', function() {
@@ -492,16 +507,12 @@ describe('App.Router', function () {
             complete: function() {}
           };
         });
-        sinon.stub(router, 'getCurrentLocationUrl').returns(mockCurrentUrl);
-        sinon.stub(router, 'redirectByURL', Em.K);
+        this.mockGetCurrentLocationUrl.returns(mockCurrentUrl);
         router.getAuthenticated();
         expect(router.redirectByURL.calledOnce).to.be.eql(test.redirectCalled);
         if (test.redirectCalled) {
           expect(router.redirectByURL.args[0][0]).to.be.eql(JSON.parse(test.responseData.responseText).jwtProviderUrl + encodeURIComponent(mockCurrentUrl));
         }
-        App.ajax.send.restore();
-        router.getCurrentLocationUrl.restore();
-        router.redirectByURL.restore();
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/utils/ajax/ajax_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/ajax/ajax_test.js b/ambari-web/test/utils/ajax/ajax_test.js
index 5eaafc7..693829c 100644
--- a/ambari-web/test/utils/ajax/ajax_test.js
+++ b/ambari-web/test/utils/ajax/ajax_test.js
@@ -110,17 +110,14 @@ describe('App.ajax', function() {
 
   describe('#formatRequest', function() {
 
-    it('App.testMode = true', function() {
-      sinon.stub(App, 'get', function(k) {
-        if ('testMode' === k) return true;
-        return Em.get(App, k);
-      });
-      var r = App.ajax.fakeFormatRequest({real:'/', mock: '/some_url'}, {});
-      expect(r.type).to.equal('GET');
-      expect(r.url).to.equal('/some_url');
-      expect(r.dataType).to.equal('json');
+    beforeEach(function () {
+      sinon.stub(App, 'get').withArgs('testMode').returns(false);
+    });
+
+    afterEach(function () {
       App.get.restore();
     });
+
     var tests = [
       {
         urlObj: {
@@ -138,14 +135,9 @@ describe('App.ajax', function() {
     ];
     tests.forEach(function(test) {
       it(test.m, function() {
-        sinon.stub(App, 'get', function(k) {
-          if ('testMode' === k) return false;
-          return Em.get(App, k);
-        });
         var r = App.ajax.fakeFormatRequest(test.urlObj, test.data);
         expect(r.type).to.equal(test.e.type);
         expect(r.url).to.equal(test.e.url);
-        App.get.restore();
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/utils/blueprint_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js
index 5364bb9..7d4f2de 100644
--- a/ambari-web/test/utils/blueprint_test.js
+++ b/ambari-web/test/utils/blueprint_test.js
@@ -387,7 +387,7 @@ describe('utils/blueprint', function() {
   });
 
   describe("#getComponentForHosts()", function() {
-
+    var res;
     beforeEach(function() {
       sinon.stub(App.ClientComponent, 'find').returns([
         Em.Object.create({
@@ -407,6 +407,7 @@ describe('utils/blueprint', function() {
           hostNames: ["host3"]
         })
       ]);
+      res = blueprintUtils.getComponentForHosts();
     });
     afterEach(function() {
       App.ClientComponent.find.restore();
@@ -414,13 +415,18 @@ describe('utils/blueprint', function() {
       App.MasterComponent.find.restore();
     });
 
-    it("generate components to host map", function() {
-      var res = blueprintUtils.getComponentForHosts();
-      expect(res['host1'][0]).to.eql("C1");
-      expect(res['host2'][0]).to.eql("C1");
-      expect(res['host2'][1]).to.eql("C2");
-      expect(res['host3'][0]).to.eql("C2");
-      expect(res['host3'][1]).to.eql("C3");
+    it('map for 3 items is created', function () {
+      expect(Object.keys(res)).to.have.property('length').equal(3);
+    });
+
+    it("host1 map is valid", function() {
+      expect(res.host1.toArray()).to.eql(['C1']);
+    });
+    it("host2 map is valid", function() {
+      expect(res.host2.toArray()).to.eql(['C1', 'C2']);
+    });
+    it("host3 map is valid", function() {
+      expect(res.host3.toArray()).to.eql(['C2', 'C3']);
     });
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 2aec6cc..84231d7 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -24,10 +24,16 @@ require('models/service/hdfs');
 var setups = require('test/init_model_test');
 var modelSetup = setups.configs;
 
+function dummyCopy(val) {
+  return JSON.parse(JSON.stringify(val));
+}
+
 describe('App.config', function () {
 
   describe('#fileConfigsIntoTextarea', function () {
+
     var filename = 'capacity-scheduler.xml';
+
     var configs = [
       {
         name: 'config1',
@@ -42,69 +48,110 @@ describe('App.config', function () {
         filename: 'capacity-scheduler.xml'
       }
     ];
-    it('two configs into textarea', function () {
-      var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
-      expect(result.length).to.equal(1);
-      expect(result[0].value).to.equal('config1=value1\nconfig2=value2\n');
-      expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\n');
-    });
-    it('three config into textarea', function () {
-      configs.push({
-        name: 'config3',
-        value: 'value3',
-        recommendedValue: 'value3',
-        filename: 'capacity-scheduler.xml'
+
+    var c3 = {
+      name: 'config3',
+      value: 'value3',
+      recommendedValue: 'value3',
+      filename: 'capacity-scheduler.xml'
+    };
+
+    describe('two configs into textarea', function () {
+      var result;
+      beforeEach(function () {
+        result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
+      });
+      it('One config is returned', function () {
+        expect(result.length).to.equal(1);
+      });
+      it('value is valid', function () {
+        expect(result[0].value).to.equal('config1=value1\nconfig2=value2\n');
+      });
+      it('recommendedValue is valid', function () {
+        expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\n');
+      });
+    });
+
+    describe('three config into textarea', function () {
+      var newConfigs = dummyCopy(configs);
+      newConfigs.push(dummyCopy(c3));
+      var result;
+      beforeEach(function () {
+        result = App.config.fileConfigsIntoTextarea.call(App.config, newConfigs, filename);
+      });
+      it('One config is returned', function () {
+        expect(result.length).to.equal(1);
+      });
+      it('valid is valid', function () {
+        expect(result[0].value).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n');
+      });
+      it('recommendedValue is valid', function () {
+        expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n');
+      });
+    });
+
+    describe('one of three configs has different filename', function () {
+      var newConfigs = dummyCopy(configs);
+      newConfigs.push(dummyCopy(c3));
+      newConfigs[1].filename = 'another filename';
+      var result;
+
+      beforeEach(function () {
+        result = App.config.fileConfigsIntoTextarea.call(App.config, newConfigs, filename);
+      });
+
+      it('Two configs are returned', function () {
+        //result contains two configs: one with different filename and one textarea config
+        expect(result.length).to.equal(2);
+      });
+      it('Value is valid', function () {
+        expect(result[1].value).to.equal('config1=value1\nconfig3=value3\n');
+      });
+      it('RecommendedValue is valid', function () {
+        expect(result[1].recommendedValue).to.equal('config1=value1\nconfig3=value3\n');
+      });
+    });
+
+    describe('none configs into empty textarea', function () {
+      var result;
+      beforeEach(function () {
+        result = App.config.fileConfigsIntoTextarea.call(App.config, [], 'capacity-scheduler.xml');
+      });
+      it('One config is returned', function () {
+        expect(result.length).to.equal(1);
+      });
+      it('value is empty', function () {
+        expect(result[0].value).to.equal('');
+      });
+      it('recommendedValue is none', function () {
+        expect(Em.isNone(result[0].recommendedValue)).to.be.true;
+      });
+      it('savedValue is none', function () {
+        expect(Em.isNone(result[0].savedValue)).to.be.true;
+      });
+    });
+
+    describe("filename has configs that shouldn't be included in textarea", function () {
+      var newConfigs = dummyCopy(configs);
+      newConfigs.push(dummyCopy(c3));
+      var result;
+      beforeEach(function () {
+        result = App.config.fileConfigsIntoTextarea.call(App.config, newConfigs, 'capacity-scheduler.xml', [c3]);
+      });
+      it('Two configs are returned', function () {
+        expect(result.length).to.equal(2);
+      });
+      it('value is correct', function () {
+        expect(result[1].value).to.equal('config1=value1\nconfig2=value2\n');
+      });
+      it('recommendedValue is correct', function () {
+        expect(result[1].recommendedValue).to.equal('config1=value1\nconfig2=value2\n');
+      });
+      it('skipped config is correct', function () {
+        expect(newConfigs.findProperty('name', 'config3')).to.eql(c3);
       });
-      var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
-      expect(result.length).to.equal(1);
-      expect(result[0].value).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n');
-      expect(result[0].recommendedValue).to.equal('config1=value1\nconfig2=value2\nconfig3=value3\n');
-    });
-    it('one of three configs has different filename', function () {
-      configs[1].filename = 'another filename';
-      var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
-      //result contains two configs: one with different filename and one textarea config
-      expect(result.length).to.equal(2);
-      expect(result[1].value).to.equal('config1=value1\nconfig3=value3\n');
-      expect(result[1].recommendedValue).to.equal('config1=value1\nconfig3=value3\n');
-    });
-    it('none configs into empty textarea', function () {
-      filename = 'capacity-scheduler.xml';
-      configs.clear();
-      var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
-      expect(result.length).to.equal(1);
-      expect(result[0].value).to.equal('');
-      expect(Em.isNone(result[0].recommendedValue)).to.be.true;
-      expect(Em.isNone(result[0].savedValue)).to.be.true;
-    });
-    it("filename has configs that shouldn't be included in textarea", function () {
-      var configs = [
-        {
-          name: 'config1',
-          value: 'value1',
-          recommendedValue: 'value1',
-          filename: filename
-        },
-        {
-          name: 'config2',
-          value: 'value2',
-          recommendedValue: 'value2',
-          filename: filename
-        }
-      ];
-      var cfg = {
-        name: 'config3',
-        value: 'value3',
-        recommendedValue: 'value3',
-        filename: filename
-      };
-      configs.push(cfg);
-      var result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename, [cfg]);
-      expect(result.length).to.equal(2);
-      expect(result[1].value).to.equal('config1=value1\nconfig2=value2\n');
-      expect(result[1].recommendedValue).to.equal('config1=value1\nconfig2=value2\n');
-      expect(configs.findProperty('name', 'config3')).to.eql(cfg);
     });
+
   });
 
   describe('#textareaIntoFileConfigs', function () {
@@ -144,35 +191,85 @@ describe('App.config', function () {
       }
     ];
 
-    it('config1=value1 to one config', function () {
-      var result = App.config.textareaIntoFileConfigs.call(App.config, testData[0].configs, filename);
-      expect(result.length).to.equal(1);
-      expect(result[0].value).to.equal('value1');
-      expect(result[0].name).to.equal('config1');
-      expect(result[0].isRequiredByAgent).to.be.true;
-    });
-    it('config1=value1\\nconfig2=value2\\n to two configs', function () {
-      var result = App.config.textareaIntoFileConfigs.call(App.config, testData[1].configs, filename);
-      expect(result.length).to.equal(2);
-      expect(result[0].value).to.equal('value1');
-      expect(result[0].name).to.equal('config1');
-      expect(result[1].value).to.equal('value2');
-      expect(result[1].name).to.equal('config2');
-      expect(result[0].isRequiredByAgent).to.be.false;
-      expect(result[1].isRequiredByAgent).to.be.false;
-    });
-    it('config1=value1,value2\n to one config', function () {
-      var result = App.config.textareaIntoFileConfigs.call(App.config, testData[2].configs, filename);
-      expect(result.length).to.equal(1);
-      expect(result[0].value).to.equal('value1,value2');
-      expect(result[0].name).to.equal('config1');
-      expect(result[0].isRequiredByAgent).to.be.true;
-    });
-    it('config1=value1 config2=value2 to two configs', function () {
-      var result = App.config.textareaIntoFileConfigs.call(App.config, testData[3].configs, filename);
-      expect(result.length).to.equal(1);
-      expect(result[0].isRequiredByAgent).to.be.false;
+    describe('config1=value1 to one config', function () {
+      var result;
+      beforeEach(function () {
+        result = App.config.textareaIntoFileConfigs.call(App.config, testData[0].configs, filename);
+      });
+      it('One config is returned', function () {
+        expect(result.length).to.equal(1);
+      });
+      it('value is correct', function () {
+        expect(result[0].value).to.equal('value1');
+      });
+      it('name is correct', function () {
+        expect(result[0].name).to.equal('config1');
+      });
+      it('isRequiredByAgent is true', function () {
+        expect(result[0].isRequiredByAgent).to.be.true;
+      });
+    });
+
+    describe('config1=value1\\nconfig2=value2\\n to two configs', function () {
+      var result;
+      beforeEach(function () {
+        result = App.config.textareaIntoFileConfigs.call(App.config, testData[1].configs, filename);
+      });
+      it('Two configs are returned', function (){
+        expect(result.length).to.equal(2);
+      });
+      it('1st value is valid', function (){
+        expect(result[0].value).to.equal('value1');
+      });
+      it('1st name is valid', function (){
+        expect(result[0].name).to.equal('config1');
+      });
+      it('2nd value is valid', function (){
+        expect(result[1].value).to.equal('value2');
+      });
+      it('2nd name is valid', function (){
+        expect(result[1].name).to.equal('config2');
+      });
+      it('1st isRequiredByAgent is false', function (){
+        expect(result[0].isRequiredByAgent).to.be.false;
+      });
+      it('2nd isRequiredByAgent is false', function (){
+        expect(result[1].isRequiredByAgent).to.be.false;
+      });
+    });
+
+    describe('config1=value1,value2\n to one config', function () {
+      var result;
+      beforeEach(function () {
+        result = App.config.textareaIntoFileConfigs.call(App.config, testData[2].configs, filename);
+      });
+      it('One config is returned', function () {
+        expect(result.length).to.equal(1);
+      });
+      it('value is correct', function () {
+        expect(result[0].value).to.equal('value1,value2');
+      });
+      it('name is correct', function () {
+        expect(result[0].name).to.equal('config1');
+      });
+      it('isRequiredByAgent is true', function () {
+        expect(result[0].isRequiredByAgent).to.be.true;
+      });
     });
+
+    describe('config1=value1 config2=value2 to two configs', function () {
+      var result;
+      beforeEach(function () {
+        result = App.config.textareaIntoFileConfigs.call(App.config, testData[3].configs, filename);
+      });
+      it('One config is returned', function () {
+        expect(result.length).to.equal(1);
+      });
+      it('isRequiredByAgent is false', function () {
+        expect(result[0].isRequiredByAgent).to.be.false;
+      });
+    });
+
   });
 
   describe('#trimProperty',function() {
@@ -584,12 +681,23 @@ describe('App.config', function () {
       }
     });
 
-    it('overrides some values that should be different for override', function() {
-      var override = App.config.createOverride(configProperty, {}, group);
-      expect(override.get('isOriginalSCP')).to.be.false;
-      expect(override.get('overrides')).to.be.null;
-      expect(override.get('group')).to.eql(group);
-      expect(override.get('parentSCP')).to.eql(configProperty);
+    describe('overrides some values that should be different for override', function() {
+      var override;
+      beforeEach(function () {
+        override = App.config.createOverride(configProperty, {}, group);
+      });
+      it('isOriginalSCP is false', function () {
+        expect(override.get('isOriginalSCP')).to.be.false;
+      });
+      it('overrides is null', function () {
+        expect(override.get('overrides')).to.be.null;
+      });
+      it('group is valid', function () {
+        expect(override.get('group')).to.eql(group);
+      });
+      it('parentSCP is valid', function () {
+        expect(override.get('parentSCP')).to.eql(configProperty);
+      });
     });
 
     it('overrides some specific values', function() {
@@ -868,10 +976,16 @@ describe('App.config', function () {
     it('create default config object', function () {
       expect(App.config.createDefaultConfig('pName', 'pServiceName', 'pFileName', true)).to.eql(res);
     });
-    it('runs proper methods', function() {
+    it('getDefaultDisplayType is called', function() {
       expect(App.config.getDefaultDisplayType.called).to.be.true;
+    });
+    it('getDefaultCategory is called with correct arguments', function() {
       expect(App.config.getDefaultCategory.calledWith(true, 'pFileName')).to.be.true;
+    });
+    it('getIsSecure is called with correct arguments', function() {
       expect(App.config.getIsSecure.calledWith('pName')).to.be.true;
+    });
+    it('shouldSupportFinal is called with correct arguments', function() {
       expect(App.config.shouldSupportFinal.calledWith('pServiceName', 'pFileName')).to.be.true;
     });
   });
@@ -1103,4 +1217,5 @@ describe('App.config', function () {
       expect(App.config.truncateGroupName('group_has_more_than_max_characters')).to.equal('group_has...haracters');
     });
   });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/utils/configs/config_initializer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/config_initializer_test.js b/ambari-web/test/utils/configs/config_initializer_test.js
index 528dcb2..b98581a 100644
--- a/ambari-web/test/utils/configs/config_initializer_test.js
+++ b/ambari-web/test/utils/configs/config_initializer_test.js
@@ -347,23 +347,34 @@ describe('App.ConfigInitializer', function () {
       });
     });
 
-    cases['hive_database'].forEach(function (item) {
-      var title = 'hive_database value should be set to {0}';
-      it(title.format(item.value), function () {
-        sinon.stub(App, 'get')
-          .withArgs('supports.alwaysEnableManagedMySQLForHive').returns(item.alwaysEnableManagedMySQLForHive)
-          .withArgs('router.currentState.name').returns(item.currentStateName)
-          .withArgs('isManagedMySQLForHiveEnabled').returns(item.isManagedMySQLForHiveEnabled);
-        serviceConfigProperty.setProperties({
-          name: 'hive_database',
-          value: item.receivedValue,
-          options: item.options
-        });
-        App.ConfigInitializer.initialValue(serviceConfigProperty, {}, []);
-        expect(serviceConfigProperty.get('value')).to.equal(item.value);
-        expect(serviceConfigProperty.get('options').findProperty('displayName', 'New MySQL Database').hidden).to.equal(item.hidden);
+    describe('hive_database', function () {
+
+      beforeEach(function () {
+        this.stub = sinon.stub(App, 'get');
+      });
+
+      afterEach(function () {
         App.get.restore();
       });
+
+      cases['hive_database'].forEach(function (item) {
+        var title = 'hive_database value should be set to {0}';
+        it(title.format(item.value), function () {
+          this.stub
+            .withArgs('supports.alwaysEnableManagedMySQLForHive').returns(item.alwaysEnableManagedMySQLForHive)
+            .withArgs('router.currentState.name').returns(item.currentStateName)
+            .withArgs('isManagedMySQLForHiveEnabled').returns(item.isManagedMySQLForHiveEnabled);
+          serviceConfigProperty.setProperties({
+            name: 'hive_database',
+            value: item.receivedValue,
+            options: item.options
+          });
+          App.ConfigInitializer.initialValue(serviceConfigProperty, {}, []);
+          expect(serviceConfigProperty.get('value')).to.equal(item.value);
+          expect(serviceConfigProperty.get('options').findProperty('displayName', 'New MySQL Database').hidden).to.equal(item.hidden);
+        });
+      });
+
     });
 
     cases['hbase.zookeeper.quorum'].forEach(function (item) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/utils/host_progress_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/host_progress_popup_test.js b/ambari-web/test/utils/host_progress_popup_test.js
index 1b7efb3..8ef64d2 100644
--- a/ambari-web/test/utils/host_progress_popup_test.js
+++ b/ambari-web/test/utils/host_progress_popup_test.js
@@ -453,6 +453,7 @@ describe('App.HostPopup', function () {
     beforeEach(function (){
       sinon.stub(App.HostPopup, "get").returns(true);
       sinon.spy(App.HostPopup, "set");
+      this.stub = sinon.stub(App.router, "get");
     });
 
     afterEach(function (){
@@ -462,14 +463,14 @@ describe('App.HostPopup', function () {
     });
 
     it("should display '2 Background Operations Running' when there are 2 background operations running", function(){
-      sinon.stub(App.router, "get").returns(2);
+      this.stub.returns(2);
       App.HostPopup.setBackgroundOperationHeader(false);
 
       expect(App.HostPopup.set.calledWith("popupHeaderName", "2 Background Operations Running")).to.be.true;
     });
 
     it("should display '1 Background Operation Running' when there is 1 background operation running", function(){
-      sinon.stub(App.router, "get").returns(1);
+      this.stub.returns(1);
       App.HostPopup.setBackgroundOperationHeader(false);
 
       expect(App.HostPopup.set.calledWith("popupHeaderName", "1 Background Operation Running")).to.be.true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/utils/ui_effects_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/ui_effects_test.js b/ambari-web/test/utils/ui_effects_test.js
index 7126e5d..c4736ce 100644
--- a/ambari-web/test/utils/ui_effects_test.js
+++ b/ambari-web/test/utils/ui_effects_test.js
@@ -24,6 +24,12 @@ describe('utils/ui_effects', function(){
     beforeEach(function(){
       $('body').append('<div id="pulsate-test-dom"></div>');
       this.clock = sinon.useFakeTimers();
+      this.clb = Em.K;
+      sinon.spy(this, 'clb');
+    });
+
+    afterEach(function () {
+      this.clb.restore();
     });
 
     it('opacity should be 0.2 on 5-th iteration', function() {
@@ -34,10 +40,9 @@ describe('utils/ui_effects', function(){
     });
     it('should call callback at the end', function() {
       var domEl = $('#pulsate-test-dom');
-      var stub = sinon.stub();
-      ui_utils.pulsate(domEl, 1000, stub);
+      ui_utils.pulsate(domEl, 1000, this.clb);
       this.clock.tick(2000);
-      expect(stub.calledOnce).to.be.ok;
+      expect(this.clb.calledOnce).to.be.ok;
     });
 
     afterEach(function(){

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/chart/linear_time_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/chart/linear_time_test.js b/ambari-web/test/views/common/chart/linear_time_test.js
index 1d07dbe..1c9e5ee 100644
--- a/ambari-web/test/views/common/chart/linear_time_test.js
+++ b/ambari-web/test/views/common/chart/linear_time_test.js
@@ -370,7 +370,7 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
       expect(aggregator.get('requests')).to.not.be.empty;
       expect(window.setTimeout.called).to.be.false;
     });
-    it("timeout started", function () {
+    it("timeout started (2)", function () {
       aggregator.set('timeoutId', null);
       aggregator.get('requests').clear();
       aggregator.add({}, {});

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/configs/config_history_flow_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/config_history_flow_test.js b/ambari-web/test/views/common/configs/config_history_flow_test.js
index 667c7a4..df777e9 100644
--- a/ambari-web/test/views/common/configs/config_history_flow_test.js
+++ b/ambari-web/test/views/common/configs/config_history_flow_test.js
@@ -305,54 +305,91 @@ describe.skip('App.ConfigHistoryFlowView', function () {
   });
 
   describe('#willInsertElement()', function () {
+
     beforeEach(function () {
       sinon.stub(view, 'adjustFlowView', Em.K);
       sinon.stub(view, 'keepInfoBarAtTop', Em.K);
     });
+
     afterEach(function () {
       view.adjustFlowView.restore();
       view.keepInfoBarAtTop.restore();
     });
-    it('Only current version is present', function () {
-      view.set('serviceVersions', [Em.Object.create({isCurrent: true})]);
 
-      view.willInsertElement();
-      expect(view.adjustFlowView.calledOnce).to.be.true;
-      expect(view.keepInfoBarAtTop.calledOnce).to.be.true;
-      expect(view.get('startIndex')).to.equal(0);
-      expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([true]);
+    describe('Only current version is present', function () {
+
+      beforeEach(function () {
+        view.set('serviceVersions', [Em.Object.create({isCurrent: true})]);
+        view.willInsertElement();
+      });
+
+      it('adjustFlowView is called once', function () {
+        expect(view.adjustFlowView.calledOnce).to.be.true;
+      });
+      it('keepInfoBarAtTop is called once', function () {
+        expect(view.keepInfoBarAtTop.calledOnce).to.be.true;
+      });
+      it('startIndex = 0', function () {
+        expect(view.get('startIndex')).to.equal(0);
+      });
+      it('serviceVersions.@each.isDisplayed = [true]', function () {
+        expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([true]);
+      });
     });
-    it('Five service versions are present', function () {
-      view.set('serviceVersions', [
-        Em.Object.create({isCurrent: true}),
-        Em.Object.create(),
-        Em.Object.create(),
-        Em.Object.create(),
-        Em.Object.create()
-      ]);
 
-      view.willInsertElement();
-      expect(view.adjustFlowView.calledOnce).to.be.true;
-      expect(view.keepInfoBarAtTop.calledOnce).to.be.true;
-      expect(view.get('startIndex')).to.equal(0);
-      expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([true, false, false, false, false]);
+    describe('Five service versions are present', function () {
+
+      beforeEach(function () {
+        view.set('serviceVersions', [
+          Em.Object.create({isCurrent: true}),
+          Em.Object.create(),
+          Em.Object.create(),
+          Em.Object.create(),
+          Em.Object.create()
+        ]);
+        view.willInsertElement();
+      });
+      it('adjustFlowView is called once', function () {
+        expect(view.adjustFlowView.calledOnce).to.be.true;
+      });
+      it('keepInfoBarAtTop is called once', function () {
+        expect(view.keepInfoBarAtTop.calledOnce).to.be.true;
+      });
+      it('startIndex = 0', function () {
+        expect(view.get('startIndex')).to.equal(0);
+      });
+      it('serviceVersions.@each.isDisplayed = [true, false, false, false, false]', function () {
+        expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([true, false, false, false, false]);
+      });
     });
-    it('Six service versions are present', function () {
-      view.set('serviceVersions', [
-        Em.Object.create({isCurrent: true}),
-        Em.Object.create(),
-        Em.Object.create(),
-        Em.Object.create(),
-        Em.Object.create(),
-        Em.Object.create()
-      ]);
 
-      view.willInsertElement();
-      expect(view.adjustFlowView.calledOnce).to.be.true;
-      expect(view.keepInfoBarAtTop.calledOnce).to.be.true;
-      expect(view.get('startIndex')).to.equal(1);
-      expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([true, false, false, false, false, false]);
+    describe('Six service versions are present', function () {
+      beforeEach(function () {
+        view.set('serviceVersions', [
+          Em.Object.create({isCurrent: true}),
+          Em.Object.create(),
+          Em.Object.create(),
+          Em.Object.create(),
+          Em.Object.create(),
+          Em.Object.create()
+        ]);
+        view.willInsertElement();
+      });
+
+      it('adjustFlowView is called once', function () {
+        expect(view.adjustFlowView.calledOnce).to.be.true;
+      });
+      it('keepInfoBarAtTop is called once', function () {
+        expect(view.keepInfoBarAtTop.calledOnce).to.be.true;
+      });
+      it('startIndex is 1', function () {
+        expect(view.get('startIndex')).to.equal(1);
+      });
+      it('serviceVersions.@each.isDisplayed = [true, false, false, false, false, false]', function () {
+        expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([true, false, false, false, false, false]);
+      });
     });
+
   });
 
   describe('#setInfoBarPosition()', function () {
@@ -382,12 +419,19 @@ describe.skip('App.ConfigHistoryFlowView', function () {
     var infoBar = {
       css: Em.K
     };
+
+    beforeEach(function () {
+      sinon.spy(infoBar, 'css');
+    });
+
+    afterEach(function () {
+      infoBar.css.restore();
+    });
+
     testCases.forEach(function (test) {
       it('scroll top - ' + test.params.scrollTop + ', default top - ' + test.params.defaultTop, function () {
-        sinon.spy(infoBar, 'css');
         view.setInfoBarPosition(infoBar, test.params.defaultTop, test.params.scrollTop);
         expect(infoBar.css.calledWith('top', test.result)).to.be.true;
-        infoBar.css.restore();
       });
     });
   });
@@ -614,20 +658,25 @@ describe.skip('App.ConfigHistoryFlowView', function () {
   });
 
   describe('#save()', function () {
-    it('modal popup should be displayed', function () {
+
+    beforeEach(function () {
       sinon.stub(App.ModalPopup, 'show', Em.K);
-      view.save();
+      sinon.stub(App.ServiceConfigVersion, 'find').returns([
+        { serviceName: 'service'}
+      ]);
+    });
 
-      expect(App.ModalPopup.show.calledOnce).to.be.true;
+    afterEach(function () {
       App.ModalPopup.show.restore();
+      App.ServiceConfigVersion.find.restore();
+    });
+
+    it('modal popup should be displayed', function () {
+      view.save();
+      expect(App.ModalPopup.show.calledOnce).to.be.true;
     });
 
     it('controller properties should be modified on save', function () {
-      sinon.stub(App.ServiceConfigVersion, 'find').returns([
-        {
-          serviceName: 'service'
-        }
-      ]);
       view.setProperties({
         'serviceName': 'service',
         'controller.saveConfigsFlag': false,
@@ -757,16 +806,22 @@ describe.skip('App.ConfigHistoryFlowView', function () {
       }
     ];
 
+    beforeEach(function () {
+      sinon.stub(view, 'adjustFlowView', Em.K);
+    });
+
+    afterEach(function () {
+      view.adjustFlowView.restore();
+    });
+
     testCases.forEach(function (test) {
       it('start index - ' + test.params.startIndex + ', serviceVersions length - ' + test.params.serviceVersions.length + ', versionIndex - ' + test.params.versionIndex, function () {
-        sinon.stub(view, 'adjustFlowView', Em.K);
         view.set('serviceVersions', test.params.serviceVersions);
         view.set('startIndex', test.params.startIndex);
         view.shiftFlowOnSwitch(test.params.versionIndex);
 
         expect(view.get('startIndex')).to.eql(test.result.startIndex);
         expect(view.adjustFlowView.calledOnce).to.eql(test.result.adjustFlowViewCall);
-        view.adjustFlowView.restore();
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
index 4552f78..3af85ac 100644
--- a/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
+++ b/ambari-web/test/views/common/configs/custom_category_views/notification_configs_view_test.js
@@ -66,7 +66,7 @@ describe('App.NotificationsConfigsView', function () {
 
     });
 
-    it('should update category configs', function () {
+    describe('should update category configs', function () {
       var configs = [
         Em.Object.create({
           name: "create_notification",
@@ -82,12 +82,21 @@ describe('App.NotificationsConfigsView', function () {
         })
       ];
 
-      view.set('categoryConfigsAll', configs);
-      view.didInsertElement();
-      expect(view.get('createNotification')).to.equal('yes');
-      expect(view.get('tlsOrSsl')).to.equal('ssl');
-      expect(configs.findProperty('name', 'smtp_use_auth').get('value')).to.be.true;
-      expect(view.updateCategoryConfigs.called).to.be.true;
+      beforeEach(function () {
+        view.set('categoryConfigsAll', configs);
+        view.didInsertElement();
+      });
+
+      it('createNotification = yes', function () {
+        expect(view.get('createNotification')).to.equal('yes');
+      });
+      it('tlsOrSsl = ssl', function () {
+        expect(view.get('tlsOrSsl')).to.equal('ssl');
+      });
+      it('updateCategoryConfigs is called once', function () {
+        expect(view.updateCategoryConfigs.called).to.be.true;
+      });
+
     });
   });
 
@@ -218,19 +227,38 @@ describe('App.NotificationsConfigsView', function () {
       config.validate.restore();
     });
 
-    it("flag is true", function () {
-      view.updateConfig(config, true);
-      expect(config.get('isRequired')).to.be.true;
-      expect(config.get('isEditable')).to.be.true;
-      expect(config.validate.calledOnce).to.be.true;
+    describe("flag is true", function () {
+
+      beforeEach(function () {
+        view.updateConfig(config, true);
+      });
+      it('isRequired is true', function () {
+        expect(config.get('isRequired')).to.be.true;
+      });
+      it('isEditable is true', function () {
+        expect(config.get('isEditable')).to.be.true;
+      });
+      it('validate is called once', function () {
+        expect(config.validate.calledOnce).to.be.true;
+      });
     });
 
-    it("flag is false", function () {
-      view.updateConfig(config, false);
-      expect(config.get('isRequired')).to.be.false;
-      expect(config.get('isEditable')).to.be.false;
-      expect(config.get('errorMessage')).to.be.empty;
-      expect(config.validate.called).to.be.false;
+    describe("flag is false", function () {
+      beforeEach(function () {
+        view.updateConfig(config, false);
+      });
+      it('isRequired is false', function () {
+        expect(config.get('isRequired')).to.be.false;
+      });
+      it('isEditable is false', function () {
+        expect(config.get('isEditable')).to.be.false;
+      });
+      it('errorMessage is empty', function () {
+        expect(config.get('errorMessage')).to.be.empty;
+      });
+      it('validate is not called', function () {
+        expect(config.validate.called).to.be.false;
+      });
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
index 167c007..3451964 100644
--- a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
+++ b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
@@ -180,17 +180,26 @@ describe('App.ServiceConfigsByCategoryView', function () {
       }
     ];
 
+    beforeEach(function () {
+      this._view = App.ServiceConfigsByCategoryView.create({
+        serviceConfigs: Em.A([])
+      });
+      sinon.stub(this._view, 'filteredCategoryConfigs', Em.K);
+    });
+
+    afterEach(function () {
+      this._view.filteredCategoryConfigs.restore();
+      this._view.destroy();
+    });
+
     tests.forEach(function(test) {
       it(test.m, function() {
-        var _view = App.ServiceConfigsByCategoryView.create({
-          serviceConfigs: Em.A([]),
+        this._view.reopen({
           category: test.category,
           categoryConfigs: test.categoryConfigs
         });
-        sinon.stub(_view, 'filteredCategoryConfigs', Em.K);
-        _view.filteredCategoryConfigs.restore();
-        expect(_view.get('isShowBlock')).to.be.eql(test.e);
-        _view.destroy();
+        expect(this._view.get('isShowBlock')).to.be.eql(test.e);
+
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
index 16a24e9..4e1caa1 100644
--- a/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/list_config_widget_view_test.js
@@ -175,19 +175,30 @@ describe('App.ListConfigWidgetView', function () {
   describe('#toggleOption', function () {
 
     beforeEach(function() {
-      sinon.stub(view, 'sendRequestRorDependentConfigs', Em.K)
+      sinon.stub(view, 'sendRequestRorDependentConfigs', Em.K);
+      view.toggleOption({context: view.get('options')[2]});
     });
     afterEach(function() {
       view.sendRequestRorDependentConfigs.restore();
     });
 
-    it('should doesn\'t do nothing if maximum number of options is selected', function () {
-      view.toggleOption({context: view.get('options')[2]});
-      expect(view.get('options')[2].get('isSelected')).to.be.true;
-      expect(view.get('options')[3].get('isDisabled')).to.be.true;
-      expect(view.get('options')[3].get('isSelected')).to.be.false;
-      expect(view.get('options')[4].get('isDisabled')).to.be.true;
-      expect(view.get('options')[4].get('isSelected')).to.be.false;
+    describe('should doesn\'t do nothing if maximum number of options is selected', function () {
+
+      it('isSelected', function () {
+        expect(view.get('options')[2].get('isSelected')).to.be.true;
+        expect(view.get('options')[3].get('isSelected')).to.be.false;
+        expect(view.get('options')[4].get('isSelected')).to.be.false;
+      });
+
+      it('isDisabled', function () {
+        expect(view.get('options')[3].get('isDisabled')).to.be.true;
+        expect(view.get('options')[4].get('isDisabled')).to.be.true;
+      });
+
+    });
+
+    it('should doesn\'t do nothing if maximum number of options is selected (2)', function () {
+
       view.toggleOption({context: view.get('options')[3]});
       expect(view.get('options')[3].get('isDisabled')).to.be.true;
       expect(view.get('options')[3].get('isSelected')).to.be.false;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
index ba97224..3214c5b 100644
--- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js
@@ -138,53 +138,162 @@ describe('App.SliderConfigWidgetView', function () {
 
   describe('#mirrorValueObs', function () {
 
-    it('check int', function () {
-      viewInt.set('mirrorValue', 1000);
-      expect(viewInt.get('isMirrorValueValid')).to.be.true;
-      expect(viewInt.get('config.value')).to.equal('1000');
-      expect(viewInt.get('config.errorMessage')).to.equal('');
-      expect(viewInt.get('config.warnMessage')).to.equal('');
-      expect(viewInt.get('config.warn')).to.be.false;
-
-      viewInt.set('mirrorValue', 100500);
-      expect(viewInt.get('isMirrorValueValid')).to.be.false;
-      expect(viewInt.get('config.value')).to.equal('1000');
-      expect(viewInt.get('config.errorMessage')).to.equal('');
-      expect(viewInt.get('config.warnMessage')).to.have.property('length').that.is.least(1);
-      expect(viewInt.get('config.warn')).to.be.true;
+    describe('check int', function () {
+
+      describe('valid value', function () {
+
+        beforeEach(function () {
+          viewInt.set('mirrorValue', 1000);
+        });
+
+        it('isMirrorValueValid is true', function () {
+          expect(viewInt.get('isMirrorValueValid')).to.be.true;
+        });
+        it('config value is 1000', function () {
+          expect(viewInt.get('config.value')).to.equal('1000');
+        });
+        it('errorMessage is empty', function () {
+          expect(viewInt.get('config.errorMessage')).to.equal('');
+        });
+        it('warnMessage is empty', function () {
+          expect(viewInt.get('config.warnMessage')).to.equal('');
+        });
+        it('warn is false', function () {
+          expect(viewInt.get('config.warn')).to.be.false;
+        });
+
+      });
+
+      describe('invalid value', function () {
+
+        beforeEach(function () {
+          viewInt.set('mirrorValue', 100500);
+        });
+
+        it('isMirrorValueValid is false', function () {
+          expect(viewInt.get('isMirrorValueValid')).to.be.false;
+        });
+        it('config value is 486', function () {
+          expect(viewInt.get('config.value')).to.equal('486');
+        });
+        it('errorMessage is empty', function () {
+          expect(viewInt.get('config.errorMessage')).to.equal('');
+        });
+        it('warnMessage is not empty', function () {
+          expect(viewInt.get('config.warnMessage')).to.have.property('length').that.is.least(1);
+        });
+        it('warn is true', function () {
+          expect(viewInt.get('config.warn')).to.be.true;
+        });
+
+      });
+
     });
 
-    it('check float', function () {
-      viewFloat.set('mirrorValue', 55.5);
-      expect(viewFloat.get('isMirrorValueValid')).to.be.true;
-      expect(viewFloat.get('config.value')).to.equal('55.5');
-      expect(viewFloat.get('config.errorMessage')).to.equal('');
-      expect(viewFloat.get('config.warnMessage')).to.equal('');
-      expect(viewFloat.get('config.warn')).to.be.false;
-
-      viewFloat.set('mirrorValue', 100500.5);
-      expect(viewFloat.get('isMirrorValueValid')).to.be.false;
-      expect(viewFloat.get('config.value')).to.equal('55.5');
-      expect(viewFloat.get('config.errorMessage')).to.equal('');
-      expect(viewFloat.get('config.warnMessage')).to.have.property('length').that.is.least(1);
-      expect(viewFloat.get('config.warn')).to.be.true;
+    describe('check float', function () {
+
+      describe('valid value', function () {
+
+        beforeEach(function () {
+          viewFloat.set('mirrorValue', 55.5);
+        });
+
+        it('isMirrorValueValid is true', function () {
+          expect(viewFloat.get('isMirrorValueValid')).to.be.true;
+        });
+        it('config value is 1000', function () {
+          expect(viewFloat.get('config.value')).to.equal('55.5');
+        });
+        it('errorMessage is empty', function () {
+          expect(viewFloat.get('config.errorMessage')).to.equal('');
+        });
+        it('warnMessage is empty', function () {
+          expect(viewFloat.get('config.warnMessage')).to.equal('');
+        });
+        it('warn is false', function () {
+          expect(viewFloat.get('config.warn')).to.be.false;
+        });
+
+      });
+
+      describe('invalid value', function () {
+
+        beforeEach(function () {
+          viewFloat.set('mirrorValue', 100500.5);
+        });
+
+        it('isMirrorValueValid is false', function () {
+          expect(viewFloat.get('isMirrorValueValid')).to.be.false;
+        });
+        it('config value is 1000', function () {
+          expect(viewFloat.get('config.value')).to.equal('72.2');
+        });
+        it('errorMessage is empty', function () {
+          expect(viewFloat.get('config.errorMessage')).to.equal('');
+        });
+        it('warnMessage is not empty', function () {
+          expect(viewFloat.get('config.warnMessage')).to.have.property('length').that.is.least(1);
+        });
+        it('warn is true', function () {
+          expect(viewFloat.get('config.warn')).to.be.true;
+        });
+
+      });
+
     });
 
-    it('check percent', function () {
-      viewPercent.set('mirrorValue', 32);
-      expect(viewPercent.get('isMirrorValueValid')).to.be.true;
-      expect(viewPercent.get('config.value')).to.equal('0.32');
-      expect(viewPercent.get('config.errorMessage')).to.equal('');
-      expect(viewPercent.get('config.warnMessage')).to.equal('');
-      expect(viewPercent.get('config.warn')).to.be.false;
-
-      viewPercent.set('mirrorValue', 100500.5);
-      expect(viewPercent.get('isMirrorValueValid')).to.be.false;
-      expect(viewPercent.get('config.value')).to.equal('0.32');
-      expect(viewPercent.get('config.errorMessage')).to.equal('');
-      expect(viewPercent.get('config.warnMessage')).to.have.property('length').that.is.least(1);
-      expect(viewPercent.get('config.warn')).to.be.true;
+    describe('check percent', function () {
+
+      describe('valid value', function () {
+
+        beforeEach(function () {
+          viewPercent.set('mirrorValue', 32);
+        });
+
+        it('isMirrorValueValid is true', function () {
+          expect(viewPercent.get('isMirrorValueValid')).to.be.true;
+        });
+        it('config value is 1000', function () {
+          expect(viewPercent.get('config.value')).to.equal('0.32');
+        });
+        it('errorMessage is empty', function () {
+          expect(viewPercent.get('config.errorMessage')).to.equal('');
+        });
+        it('warnMessage is empty', function () {
+          expect(viewPercent.get('config.warnMessage')).to.equal('');
+        });
+        it('warn is false', function () {
+          expect(viewPercent.get('config.warn')).to.be.false;
+        });
+
+      });
+
+      describe('invalid value', function () {
+
+        beforeEach(function () {
+          viewPercent.set('mirrorValue', 100500.5);
+        });
+
+        it('isMirrorValueValid is false', function () {
+          expect(viewPercent.get('isMirrorValueValid')).to.be.false;
+        });
+        it('config value is 1000', function () {
+          expect(viewPercent.get('config.value')).to.equal('0.22');
+        });
+        it('errorMessage is empty', function () {
+          expect(viewPercent.get('config.errorMessage')).to.equal('');
+        });
+        it('warnMessage is not empty', function () {
+          expect(viewPercent.get('config.warnMessage')).to.have.property('length').that.is.least(1);
+        });
+        it('warn is true', function () {
+          expect(viewPercent.get('config.warn')).to.be.true;
+        });
+
+      });
+
     });
+
   });
 
   describe('#getValueAttributeByGroup', function() {
@@ -201,10 +310,24 @@ describe('App.SliderConfigWidgetView', function () {
 
   describe('#initSlider', function() {
     beforeEach(function() {
-      this.view = App.SliderConfigWidgetView;
+      this.view = App.SliderConfigWidgetView.create();
+      sinon.stub(this.view, '$')
+        .withArgs('input.slider-input').returns([])
+        .withArgs('.ui-slider-wrapper:eq(0) .slider-tick').returns({
+          eq: Em.K,
+          addClass: Em.K,
+          on: Em.K,
+          append: Em.K,
+          find: Em.K,
+          css: Em.K,
+          width: function() {},
+          last: Em.K,
+          hide: Em.K
+        });
     });
 
     afterEach(function() {
+      this.view.$.restore();
       this.view.destroy();
       this.view = null;
     });
@@ -423,11 +546,11 @@ describe('App.SliderConfigWidgetView', function () {
     tests.forEach(function(test) {
       it('should generate ticks: {0} - tick labels: {1}'.format(test.e.ticks, test.e.ticksLabels), function() {
         var ticks, ticksLabels;
-        this.view = this.view.create(test.viewSetup);
+        this.view.reopen(test.viewSetup);
         this.view.set('controller', {
           isCompareMode: test.viewSetup.isCompareMode
         });
-        var sliderCopy= window.Slider.prototype;
+        var sliderCopy = window.Slider.prototype;
         window.Slider = function(a, b) {
           ticks = b.ticks;
           ticksLabels = b.ticks_labels;
@@ -437,23 +560,10 @@ describe('App.SliderConfigWidgetView', function () {
             }
           };
         };
-        sinon.stub(this.view, '$')
-          .withArgs('input.slider-input').returns([])
-          .withArgs('.ui-slider-wrapper:eq(0) .slider-tick').returns({
-            eq: Em.K,
-            addClass: Em.K,
-            on: Em.K,
-            append: Em.K,
-            find: Em.K,
-            css: Em.K,
-            width: function() {},
-            last: Em.K,
-            hide: Em.K
-          });
+
         this.view.willInsertElement();
         this.view.initSlider();
         window.Slider.prototype = sliderCopy;
-        this.view.$.restore();
         expect(ticks.toArray()).to.be.eql(test.e.ticks);
         expect(ticksLabels.toArray()).to.be.eql(test.e.ticksLabels);
       });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8acfcd89/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
index 725dc81..93a0f01 100644
--- a/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/toggle_config_widget_view_test.js
@@ -73,33 +73,24 @@ describe('App.ToggleConfigWidgetView', function () {
 
   describe('#isValueCompatibleWithWidget', function () {
 
-    Em.A([
-      {
-        m: 'valid',
-        v: 'active',
-        e: true
-      },
-      {
-        m: 'invalid',
-        v: 'invalid',
-        e: false
-      }
-    ]).forEach(function (test) {
-      it(test.m, function () {
-        this.view.get('config').setProperties({
-          value: test.v,
-          isValid: true
-        });
-        expect(this.view.isValueCompatibleWithWidget()).to.equal(test.e);
-        if (test.e) {
-          expect(this.view.get('warnMessage')).to.equal('');
-          expect(this.view.get('issueMessage')).to.equal('');
-        }
-        else {
-          expect(this.view.get('warnMessage')).to.have.property('length').that.is.least(1);
-          expect(this.view.get('issueMessage')).to.have.property('length').that.is.least(1);
-        }
+    it('valid', function () {
+      this.view.get('config').setProperties({
+        value: 'active',
+        isValid: true
+      });
+      expect(this.view.isValueCompatibleWithWidget()).to.be.true;
+      expect(this.view.get('warnMessage')).to.equal('');
+      expect(this.view.get('issueMessage')).to.equal('');
+    });
+
+    it('invalid', function () {
+      this.view.get('config').setProperties({
+        value: 'invalid',
+        isValid: true
       });
+      expect(this.view.isValueCompatibleWithWidget()).to.be.false;
+      expect(this.view.get('warnMessage')).to.have.property('length').that.is.least(1);
+      expect(this.view.get('issueMessage')).to.have.property('length').that.is.least(1);
     });
 
   });