Skip to content

Instantly share code, notes, and snippets.

@lukasz-kaniowski
Created April 10, 2013 20:54
Show Gist options
  • Save lukasz-kaniowski/5358357 to your computer and use it in GitHub Desktop.
Save lukasz-kaniowski/5358357 to your computer and use it in GitHub Desktop.
angular jasmine tests
describe('Controller: TasksCtrl', function () {
// load the controller's module
beforeEach(module('yeomanAngularApp'));
var TasksCtrl,
scope,
tasks = { getAll: function () {
return [
{name: 'task_1'}
]
}};
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller) {
scope = {};
TasksCtrl = $controller('TasksCtrl', {
$scope: scope,
tasks: tasks
});
}));
it('gets all tasks from service', function () {
expect(scope.tasks.length).toBe(1);
expect(scope.tasks[0].name).toBe('task_1');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment