Comparing version 0.6.0 to 0.6.1
@@ -1,2 +0,2 @@ | ||
// Bookshelf.js 0.6.0 | ||
// Bookshelf.js 0.6.1 | ||
// --------------- | ||
@@ -86,3 +86,3 @@ | ||
// Keep in sync with `package.json`. | ||
VERSION: '0.6.0', | ||
VERSION: '0.6.1', | ||
@@ -89,0 +89,0 @@ // Helper method to wrap a series of Bookshelf actions in a `knex` transaction block; |
@@ -179,6 +179,7 @@ // Model | ||
return Promise.bind(this).all([ | ||
return Promise.all([ | ||
this.triggerThen((method === 'insert' ? 'creating' : 'updating'), this, attrs, options), | ||
this.triggerThen('saving', this, attrs, options) | ||
]) | ||
.bind(this) | ||
.then(function() { | ||
@@ -185,0 +186,0 @@ return sync[options.method](method === 'update' && options.patch ? attrs : this.attributes); |
{ | ||
"name": "bookshelf", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "A lightweight ORM for PostgreSQL, MySQL, and SQLite3, influenced by Backbone.js", | ||
@@ -5,0 +5,0 @@ "main": "bookshelf.js", |
@@ -5,11 +5,16 @@ var Promise = require('../dialects/base/promise').Promise; | ||
Promise.onPossiblyUnhandledRejection(function(e) { | ||
console.log(e.stack); | ||
process.stderr.on('data', function(data) { | ||
console.log(data); | ||
}); | ||
var Bookshelf = require('../bookshelf'); | ||
var base = require('./base'); | ||
var mocha = require('mocha'); | ||
require("mocha-as-promised")(mocha); | ||
if (process.argv.pop() === 'test/index.js') { | ||
var mocha = require('mocha'); | ||
require("mocha-as-promised")(mocha); | ||
} else { | ||
require("mocha-as-promised")(); | ||
} | ||
@@ -16,0 +21,0 @@ global.sinon = require("sinon"); |
@@ -362,2 +362,24 @@ var _ = require('lodash'); | ||
it('fires saving and creating and then saves', function() { | ||
var user = new Bookshelf.Model({first_name: 'Testing'}, {tableName: 'users'}); | ||
var query = user.query(); | ||
var events = 0; | ||
user.sync = function() { | ||
return _.extend(stubSync, { | ||
insert: function() { | ||
equal(events, 2); | ||
return Promise.resolve({}); | ||
} | ||
}); | ||
}; | ||
user.on('creating saving updating', function() { | ||
return Promise.resolve().then(function() { | ||
return Promise.resolve().then(function() { | ||
events++; | ||
}); | ||
}); | ||
}); | ||
return user.save(); | ||
}); | ||
}); | ||
@@ -364,0 +386,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256863
7014