TwoToc code
[YouAndWeb_TwoToc] / client / app / main / main.controller.spec.js
1 'use strict';
2
3 describe('Controller: MainCtrl', function() {
4
5   // load the controller's module
6   beforeEach(module('dashboardApp'));
7   beforeEach(module('stateMock'));
8
9   var MainCtrl;
10   var scope;
11   var state;
12   var $httpBackend;
13
14   // Initialize the controller and a mock scope
15   beforeEach(inject(function(_$httpBackend_, $controller, $rootScope, $state) {
16     $httpBackend = _$httpBackend_;
17     $httpBackend.expectGET('/api/shows')
18       .respond(['HTML5 Boilerplate', 'AngularJS', 'Karma', 'Express']);
19
20     scope = $rootScope.$new();
21     state = $state;
22     MainCtrl = $controller('MainCtrl', {
23       $scope: scope
24     });
25   }));
26
27   it('should attach a list of shows to the scope', function() {
28     $httpBackend.flush();
29     expect(scope.awesomeThings.length).toBe(4);
30   });
31 });