Changed User.create signature to accept a hash, added a couple of utility functions as well

This commit is contained in:
Aziz Khoury
2014-01-20 12:41:35 -05:00
parent e2960e3ed6
commit f74f01ca77
7 changed files with 61 additions and 38 deletions

View File

@@ -26,16 +26,16 @@ describe('User', function() {
describe('when created', function() {
it('should be created properly', function(done){
User.create(userData.name, userData.password, userData.email, function(error,userId){
User.create({usename: userData.name, password: userData.password, email: userData.email}, function(error,userId){
assert.equal(error, null, 'was created with error');
assert.ok(userId);
done();
});
});
it('should have a valid email', function() {
it('should have a valid email, if using an email', function() {
assert.throws(
User.create(userData.name, userData.password, 'fakeMail',function(){}),
User.create({username: userData.name, password: userData.password, email: 'fakeMail'},function(){}),
Error,
'does not validate email'
);