不要怂,就是干,撸起袖子干!

Commit bf48a03e by Sascha Depold

master logic has already been in place. added test

2 parents f8b20e35 6a831c54
Showing with 22 additions and 0 deletions
......@@ -494,5 +494,27 @@ describe(Support.getTestDialectTeaser("DaoValidator"), function() {
})
})
})
it('validates enums', function() {
var values = ['value1', 'value2']
var Bar = this.sequelize.define('Bar' + config.rand(), {
field: {
type: Sequelize.ENUM,
values: values,
validate: {
isIn: [values]
}
}
})
var failingBar = Bar.build({ field: 'value3' })
failingBar.validate().success(function(errors) {
expect(errors).not.to.be.null
expect(errors.field).to.have.length(1)
expect(errors.field[0]).to.equal("Unexpected value or invalid argument")
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!