authors table view
[angular-drzb] / test / unit / controllersSpec.js
index e0ad327..e7eb996 100644 (file)
@@ -73,3 +73,35 @@ describe('ListCtrl', function(){
        expect( scope.ValidStates ).toBeTruthy();
   });
 });
+
+
+describe('AuthorsCtrl', function(){
+  var scope, $httpBackend;
+
+  beforeEach(module('myApp'));
+
+  beforeEach(inject(function($injector) {
+    $httpBackend = $injector.get('$httpBackend');
+       $httpBackend.whenJSONP(/authors/).passThrough();
+  }));
+  afterEach(function() {
+         $httpBackend.verifyNoOutstandingExpectation();
+         $httpBackend.verifyNoOutstandingRequest();
+  });
+
+  beforeEach(inject(function($rootScope, $controller){
+    scope = $rootScope.$new();
+       var ctrl = $controller(AuthorsCtrl, { $scope: scope } );
+  }));
+
+
+  it('ready', function() {
+       $httpBackend.flush();
+       expect( scope.ready ).toBe( true );
+  });
+
+  it('data', function() {
+       $httpBackend.flush();
+       expect( scope.data ).toBeTruthy();
+  });
+});