Skip to content

Instantly share code, notes, and snippets.

@IuryAlves
Created July 17, 2015 17:52
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 IuryAlves/fe5ad20bfeab94e83741 to your computer and use it in GitHub Desktop.
Save IuryAlves/fe5ad20bfeab94e83741 to your computer and use it in GitHub Desktop.
describe("[bffdcas] EditarPerfilModel reset password ", function() {
var alertModel;
beforeEach(angular.mock.module('perfil_usuario'));
beforeEach(angular.mock.module('mockhttp'));
beforeEach(function (){
// mocka o alertModel
alertModel = {
addAlert: function(message){}
};
// espiona o método addAlert
sinon.spy(alertModel, 'addAlert');
module(function($provide){
$provide.value('alertModel', alertModel);
});
});
it('[dsadvvw] reset save image success', inject(function(EditarPerfilModel, $timeout){
var m = EditarPerfilModel;
user_mock = {
birth: "17/10/1990",
id: "batman",
email :"iuryalves20+42@gmail.com",
gender :"M",
name: "bruce wayne"
};
m.init(user_mock);
m.cropped_image = 'image_mock';
m.save_image();
$timeout.flush();
// teste para verificar se o addAlert foi chamado com a mensagem 'Sua foto foi salva!'
expect(alertModel.addAlert.calledWith("Sua foto foi salva!")).equal(true);
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment