Skip to content

Instantly share code, notes, and snippets.

@hunanboy
Forked from alexeygolev/controllerSpec.coffee
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hunanboy/2b2f71a8f9710d2c1e06 to your computer and use it in GitHub Desktop.
Save hunanboy/2b2f71a8f9710d2c1e06 to your computer and use it in GitHub Desktop.
Jasmine test spec for AngularJS official tutorial in JavaScript
'use strict';
/* jasmine specs for controllers go here */
describe('PhoneCat controllers', function() {
describe('PhoneListCtrl', function($controller){
var scope, ctrl;
beforeEach(module('phonecatApp'));
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
ctrl = $controller('PhoneListCtrl', {
$scope: scope
});
}));
it('should create "phones" model with 3 phones', function() {
expect(scope.phones.length).toBe(3);
});
it('name is world', function() {
expect(scope.name).toBe('World');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment