TwoToc code
[YouAndWeb_TwoToc] / client / app / main / main.controller.spec.js
diff --git a/client/app/main/main.controller.spec.js b/client/app/main/main.controller.spec.js
new file mode 100755 (executable)
index 0000000..38dccf2
--- /dev/null
@@ -0,0 +1,31 @@
+'use strict';
+
+describe('Controller: MainCtrl', function() {
+
+  // load the controller's module
+  beforeEach(module('dashboardApp'));
+  beforeEach(module('stateMock'));
+
+  var MainCtrl;
+  var scope;
+  var state;
+  var $httpBackend;
+
+  // Initialize the controller and a mock scope
+  beforeEach(inject(function(_$httpBackend_, $controller, $rootScope, $state) {
+    $httpBackend = _$httpBackend_;
+    $httpBackend.expectGET('/api/shows')
+      .respond(['HTML5 Boilerplate', 'AngularJS', 'Karma', 'Express']);
+
+    scope = $rootScope.$new();
+    state = $state;
+    MainCtrl = $controller('MainCtrl', {
+      $scope: scope
+    });
+  }));
+
+  it('should attach a list of shows to the scope', function() {
+    $httpBackend.flush();
+    expect(scope.awesomeThings.length).toBe(4);
+  });
+});