bookshelf-modelbase
Advanced tools
Comparing version 2.8.1 to 2.9.0
@@ -158,1 +158,5 @@ var extend = require('xtend') | ||
} | ||
module.exports.pluggable = function (bookshelf, params) { | ||
bookshelf.Model = module.exports.apply(null, arguments) | ||
} |
{ | ||
"name": "bookshelf-modelbase", | ||
"version": "2.8.1", | ||
"version": "2.9.0", | ||
"description": "Extensible ModelBase for bookshelf-based model layers", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
@@ -36,2 +36,4 @@ # bookshelf-modelbase | ||
var ModelBase = require('bookshelf-modelbase')(bookshelf); | ||
// Or initialize as a bookshelf plugin | ||
bookshelf.plugin(require('bookshelf-modelbase').pluggable); | ||
@@ -38,0 +40,0 @@ var User = ModelBase.extend({ |
@@ -1,2 +0,2 @@ | ||
/* global describe, before, beforeEach, it */ | ||
/* global describe, before, after, beforeEach, it */ | ||
@@ -35,2 +35,12 @@ var Joi = require('joi') | ||
describe('initialize', function () { | ||
var origModelBase | ||
before(function () { | ||
origModelBase = bookshelf.Model | ||
}) | ||
after(function () { | ||
bookshelf.Model = origModelBase | ||
}) | ||
it('should error if not passed bookshelf object', function () { | ||
@@ -41,2 +51,14 @@ expect(function () { | ||
}) | ||
it('should be separately applyable', function () { | ||
var Model = require('../lib/index')(bookshelf) | ||
expect(Model.findOne).to.be.a('function') | ||
expect(bookshelf.Model.findOne).to.be.undefined() | ||
}) | ||
it('should be usable as a bookshelf plugin', function () { | ||
expect(bookshelf.Model.findOne).to.be.undefined() | ||
bookshelf.plugin(function () { | ||
require('../lib/index').pluggable.apply(null, arguments) | ||
}) | ||
expect(bookshelf.Model.findOne).to.be.a('function') | ||
}) | ||
}) | ||
@@ -43,0 +65,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
22498
444
165