3 /* jasmine specs for controllers go here */
5 describe('RegistrationCtrl', function(){
7 beforeEach(module('myApp'));
9 var scope, ctrl, $httpBackend;
11 beforeEach(inject(function($injector) {
12 $httpBackend = $injector.get('$httpBackend');
15 .when('JSONP', '/<%= $couchdb_database %>/_design/registration/_view/organizations?group=true;format=key_array;callback=JSON_CALLBACK')
16 .respond({ rows: [ 'foo', 'bar', 'baz' ] })
19 $httpBackend.when('GET', 'partials/registration.html').respond('')
23 afterEach(function() {
24 $httpBackend.verifyNoOutstandingExpectation();
25 $httpBackend.verifyNoOutstandingRequest();
28 beforeEach(inject(function($rootScope, $controller) {
29 scope = $rootScope.$new();
30 ctrl = $controller(RegistrationCtrl, { $scope: scope });
33 it('organizations', function() {
35 expect(scope.organizations).toEqual(['foo','bar','baz']);
36 expect(scope.user).toBeDefined();
37 expect(scope.work).toBeDefined();
43 describe('ListCtrl', function(){
44 var scope, $httpBackend;
46 beforeEach(module('myApp'));
48 beforeEach(inject(function($injector) {
49 $httpBackend = $injector.get('$httpBackend');
51 .when('GET', '/data/%3C%25=%20$couchdb_database%20%25%3E/registration')
55 afterEach(function() {
56 $httpBackend.verifyNoOutstandingExpectation();
57 $httpBackend.verifyNoOutstandingRequest();
60 beforeEach(inject(function($rootScope, $controller){
61 scope = $rootScope.$new();
62 var ctrl = $controller(ListCtrl, { $scope: scope } );
66 it('ready', function() {
68 expect( scope.ready ).toBe( true );
71 it('ValidStates', function() {
73 expect( scope.ValidStates ).toBeTruthy();