Skip to content

Commit

Permalink
Make sure that mixins are specific to each new app.
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Feb 4, 2015
1 parent 250d17d commit 3c15bd5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
init: function () {
_.extend(this, {
methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
mixins: mixins,
mixins: mixins(),
services: {},
providers: [],
_setup: false
Expand Down
10 changes: 6 additions & 4 deletions lib/mixins/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

module.exports = [
require('./promise'),
require('./event')
];
module.exports = function() {
return [
require('./promise'),
require('./event')
];
};
10 changes: 10 additions & 0 deletions test/application.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,14 @@ describe('Feathers application', function () {
});
});
});

it('mixins are unique to one application', function() {
var app = feathers();
app.mixins.push(function() {});
assert.equal(app.mixins.length, 3);

var otherApp = feathers();
otherApp.mixins.push(function() {});
assert.equal(otherApp.mixins.length, 3);
});
});

0 comments on commit 3c15bd5

Please # to comment.