Skip to content

Instantly share code, notes, and snippets.

@deyceg
Created January 9, 2015 15:15
Show Gist options
  • Save deyceg/f38adfbfdb91021d087e to your computer and use it in GitHub Desktop.
Save deyceg/f38adfbfdb91021d087e to your computer and use it in GitHub Desktop.
//Load module and configure providers
beforeEach(module("factfind", function($provide) {
$provide.value("customer", {
getPersonalDetails: sinon.stub(),
getRetirementDetails: sinon.stub(),
setPersonalDetails: sinon.spy(),
setRetirementDetails: sinon.spy()
});
$provide.value("engine", {})
}));
//Setup common stuff
beforeEach(inject(function($rootScope, $controller, _customer_, _engine_, $q) {
scope = $rootScope.$new();
customer = _customer_;
engine = _engine_;
//Mock the engine
engine.getStatePensionDate = function(){
var defer = $q.defer();
defer.resolve(null); //This is parameterised
return defer.promise;
};
ctrl = $controller('AboutFormCtrl', {
$scope: scope,
customer: customer,
engine: engine
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment