Sha256: 2abdff162214dc6dd0a4288d72bb58dd8d2d93a8421201aa6344ccd6f114428d
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
describe("Testing Controllers", function() { describe('Controller IndexCtrl:', function() { beforeEach(module('robeaux')); var $scope, $rootScope, $httpBackend, $location, $timeout, testController, data; beforeEach(inject(function($injector) { $timeout = $injector.get('$timeout'); $httpBackend = $injector.get('$httpBackend'); $rootScope = $injector.get('$rootScope'); $location = $injector.get('$location'); $scope = $rootScope.$new(); var $controller = $injector.get('$controller'); testController = function() { return $controller('IndexCtrl', { '$scope': $scope }); }; var controller = testController(); jasmine.getJSONFixtures().fixturesPath='base/test/support'; data = loadJSONFixtures('robots.json')['robots.json']; $httpBackend.expect('GET', '/api/robots').respond(data); $httpBackend.flush(); })); afterEach(function() { $httpBackend.verifyNoOutstandingExpectation(); $httpBackend.verifyNoOutstandingRequest(); }); it('should get array of robots', function() { expect($scope.robots).toEqual(data.robots); }); describe('details:', function() { it('should redirect to robot show page', function() { expect($location.path()).toEqual(''); $scope.details(data.robots[0].name); expect($location.path()).toEqual('/robots/' + data.robots[0].name); }); }); }); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
robeaux-0.3.0 | test/controllers/index_ctrl.js |