Skip to content

Commit

Permalink
wtf bbq
Browse files Browse the repository at this point in the history
  • Loading branch information
thanpolas committed Oct 15, 2013
1 parent 172bf06 commit eeaa7ce
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/dao-factory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,27 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})

it('should allow me to set a function as default value', function(done) {
var defaultFunction = sinon.stub().returns(5)
var UserTable = this.sequelize.define('UserCol', {
aNumber: {
type: Sequelize.INTEGER,
defaultValue: defaultFunction
}
}, { timestamps: true })

UserTable.sync({ force: true }).success(function() {
UserTable.create().success(function(user) {
UserTable.create().success(function(user2) {
expect(user.aNumber).to.equal(5)
expect(user2.aNumber).to.equal(5)
expect(defaultFunction).to.have.been.called.twice
done()
})
})
})
})
})

it('should allow me to override updatedAt, createdAt, and deletedAt fields', function(done) {
var UserTable = this.sequelize.define('UserCol', {
Expand Down

0 comments on commit eeaa7ce

Please sign in to comment.