Comparing version 0.5.5 to 0.5.6
@@ -1,2 +0,2 @@ | ||
// Bookshelf.js 0.5.5 | ||
// Bookshelf.js 0.5.6 | ||
// --------------- | ||
@@ -86,3 +86,3 @@ | ||
// Keep in sync with `package.json`. | ||
VERSION: '0.5.5', | ||
VERSION: '0.5.6', | ||
@@ -89,0 +89,0 @@ // Helper method to wrap a series of Bookshelf actions in a `knex` transaction block; |
@@ -162,2 +162,8 @@ // Base Collection | ||
// Helper to mixin one or more additional items to the current prototype. | ||
CollectionBase.include = function() { | ||
_.extend.apply(_, [this.prototype].concat(_.toArray(arguments))); | ||
return this; | ||
}; | ||
exports.CollectionBase = CollectionBase; | ||
@@ -164,0 +170,0 @@ |
@@ -182,4 +182,10 @@ // Base Model | ||
ModelBase.extend = Backbone.Model.extend; | ||
ModelBase.extend = Backbone.Model.extend; | ||
// Helper to mixin one or more additional items to the current prototype. | ||
ModelBase.include = function() { | ||
_.extend.apply(_, [this.prototype].concat(_.toArray(arguments))); | ||
return this; | ||
}; | ||
exports.ModelBase = ModelBase; | ||
@@ -186,0 +192,0 @@ |
@@ -55,2 +55,6 @@ // Sync | ||
// Set the query builder on the options, in-case we need to | ||
// access in the `fetching` event handlers. | ||
options.query = this.query; | ||
// Create the deferred object, triggering a `fetching` event if the model | ||
@@ -57,0 +61,0 @@ // isn't an eager load. |
{ | ||
"name": "bookshelf", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "A lightweight ORM for PostgreSQL, MySQL, and SQLite3, influenced by Backbone.js", | ||
@@ -5,0 +5,0 @@ "main": "bookshelf.js", |
require('when/monitor/console'); | ||
var Bookshelf = require('../bookshelf'); | ||
@@ -3,0 +5,0 @@ var base = require('./base'); |
@@ -103,3 +103,6 @@ var _ = require('underscore'); | ||
var model = new Bookshelf.Model(); | ||
var model; | ||
beforeEach(function() { | ||
model = new Bookshelf.Model(); | ||
}); | ||
@@ -265,2 +268,10 @@ it('returns the Knex builder when no arguments are passed', function() { | ||
it('allows access to the query builder on the options object in the fetching event', function() { | ||
var model = new Site({id: 1}); | ||
model.on('fetching', function(model, columns, options) { | ||
expect(options.query.whereIn).to.be.a.function; | ||
}); | ||
return model.fetch(); | ||
}); | ||
}); | ||
@@ -571,7 +582,11 @@ | ||
var site = new Models.Site({name: 'Third Site'}); | ||
equal(site.hasChanged('name'), true); | ||
deepEqual(site.changed, {name: 'Third Site'}); | ||
return site.fetch().then(function() { | ||
deepEqual(site.hasChanged, {}); | ||
it('will determine whether an attribute, or the model has changed', function() { | ||
return new Models.Site({id: 1}).fetch().then(function(site) { | ||
expect(site.hasChanged()).to.be.false; | ||
site.set('name', 'Changed site'); | ||
equal(site.hasChanged('name'), true); | ||
deepEqual(site.changed, {name: 'Changed site'}); | ||
}); | ||
}); | ||
@@ -578,0 +593,0 @@ |
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
242735
6606