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

Commit dc1c1820 by Sascha Depold

test for options attribute

1 parent 81a86579
Showing with 27 additions and 1 deletions
......@@ -7,6 +7,13 @@ describe('ModelDefinition', function() {
var sequelize = new Sequelize(config.database, config.username, config.password, { logging: false })
, User = sequelize.define('User', { name: Sequelize.STRING, bio: Sequelize.TEXT })
afterEach(function() {
Helpers.async(function(done) {
sequelize.drop().on('success', done)
})
})
describe('.all', function() {
beforeEach(function() {
var createUser = function(num, cb) {
console.log('create user')
......@@ -21,7 +28,6 @@ describe('ModelDefinition', function() {
Helpers.async(function(done) { createUser(2, done) })
})
describe('.all', function() {
it("should return all users", function() {
Helpers.async(function(done) {
......@@ -33,4 +39,24 @@ describe('ModelDefinition', function() {
})
})
describe('.create with options', function() {
var Person = sequelize.define('Person', { name: Sequelize.STRING, options: Sequelize.TEXT })
beforeEach(function() {
Helpers.async(function(done) {
Person.sync({force: true}).on('success', function() { done() })
})
})
it('should allow the creation of an object with options as attribute', function() {
Helpers.async(function(done) {
var options = JSON.stringify({ foo: 'bar', bar: 'foo' })
Person.create({name: 'John Doe', options: options}).on('success', function(person) {
expect(person.options).toEqual(options)
done()
})
})
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!