This is Rails 4.0 App with angular-rails gem and jasmine gem. we also use
angularjs-rails-resource.I have rudimentary
controller:app.controller('new', duty ($scope, Appointment, flash)
{$scope.appointment = new Appointment();$scope.attachments =
[];$scope.appointment.agendas_attributes = [];$scope.createAppointment =
function(){ $scope.appointment.attachments = $scope.attachments;
$scope.appointment.create().then(function(data){ flash(data.message);
}, function(error){ flash('error', error.data.message);
$scope.appointment.$errors = error.data.errors; });};And on a section
exam in Jasmine i wish to assail dependencies with
jasmine.createSpyObj:describe("Appointment new controller",function() {var
$scope, controller, mockAppointment, mockFlash,
newCtrl;beforeEach(function() { module("appointments");
inject(function(_$rootScope_, $controller) { $scope =
_$rootScope_.$new(); $controller("new", { $scope: $scope,
Appointment: jasmine.createSpyObj("Appointment", ["create"]) });
}); });});but i get an error:TypeError: vigilant is not a functionon
line:Appointment: jasmine.createSpyObj("Appointment", ["create"])Can
anybody assistance ? :-)
No comments:
Post a Comment