Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Created September 6, 2013 18:12
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 jlsherrill/6467678 to your computer and use it in GitHub Desktop.
Save jlsherrill/6467678 to your computer and use it in GitHub Desktop.
describe('Controller: SystemEventsController', function() {
var $scope, Nutupane, SystemTask, SystemTaskPoll, $httpBackend, mockedTasks;
beforeEach(module('Bastion.systems', 'Bastion.test-mocks'));
beforeEach(function() {
inject(function(_$httpBackend_) {
$httpBackend = _$httpBackend_;
});
Nutupane = function() {
this.table = {
showColumns: function() {}
};
this.get = function() {};
};
mockedTasks = [];
});
afterEach(function() {
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
beforeEach(inject(function($controller, $rootScope) {
$scope = $rootScope.$new();
$controller('SystemEventsController', {$scope: $scope,
System: System,
SystemTask: SystemTask,
SystemTaskPoll:SystemTaskPoll,
Nutupane: Nutupane});
}));
it("Sets a table.", function() {
expect($scope.eventsTable).toBeTruthy();
});
it("provides a way to open the details panel.", function() {
$httpBackend.expectGET(Routes.apiSystemsPath() + "/tasks/").respond(mockedTasks);
spyOn($scope, "transitionTo");
$scope.eventsTable.openEventInfo({ id: 2 });
expect($scope.transitionTo).toHaveBeenCalledWith('systems.details.events.details', {eventId: 2});
});
});
ERROR:
PhantomJS 1.9 (Linux) Controller: SystemEventsController Sets a table. FAILED
ReferenceError: Can't find variable: System
at /home/jlsherri/git/katello/engines/bastion/test/systems/details/system-events.controller.test.js:41
at invoke (/home/jlsherri/git/katello/engines/bastion/vendor/assets/dev-components/angular/angular.js:2902)
at workFn (/home/jlsherri/git/katello/engines/bastion/vendor/assets/dev-components/angular-mocks/angular-mocks.js:1778)
Expected undefined to be truthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment