Merge pull request #267 from strongloop/fix/validation-test

Relax validation object test
This commit is contained in:
Ritchie Martori 2014-05-20 14:46:58 -07:00
commit ec2e877a63
1 changed files with 9 additions and 10 deletions

View File

@ -51,16 +51,15 @@ describe('User', function(){
it('Email is required', function (done) {
User.create({password: '123'}, function (err) {
assert.deepEqual(err, {name: "ValidationError",
message: "The Model instance is not valid. See `details` "
+ "property of the error object for more info.",
statusCode: 422,
details: {
context: "user",
codes: {email: ["presence", "format.blank", "uniqueness"]},
messages: {email: ["can't be blank", "is blank",
"Email already exists"]}}}
);
assert(err);
assert.equal(err.name, "ValidationError");
assert.equal(err.statusCode, 422);
assert.equal(err.details.context, "user");
assert.deepEqual(err.details.codes.email, [
'presence',
'format.blank',
'uniqueness'
]);
done();
});