Skip to content

Commit

Permalink
Refactoring. nisemono.obj() options parameter key: excepts -> except
Browse files Browse the repository at this point in the history
  • Loading branch information
kumabook committed Jan 18, 2017
1 parent dff5bed commit 283af24
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ var obj = function(object, opts) {
var key;
var fake = {};
var options = opts || {};
var excepts = options.excepts || [];
var except = options.except || [];
var only = options.only || keys(object);
for (key in object) {
if (isFunc(object[key]) && !contains(key, excepts) && contains(key, only)) {
if (isFunc(object[key]) && !contains(key, except) && contains(key, only)) {
fake[key] = func();
} else {
fake[key] = object[key];
Expand Down
10 changes: 5 additions & 5 deletions test/obj-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ describe('nisemono', function() {
assert.ok(TestHelper.isFakeFunc(fake.method2));
assert.ok(TestHelper.isFakeFunc(fake.method3));
});
context('excepts', function() {
it('should return a fake object that has fake methods excepts specified methods', function() {
var fake = nisemono.obj(obj, { excepts: ['method1'] });
context('except', function() {
it('should return a fake object that has fake methods except of specified methods', function() {
var fake = nisemono.obj(obj, { except: ['method1'] });

assert.ok(TestHelper.isFunc(obj.method1));
assert.ok(TestHelper.isFunc(obj.method2));
Expand All @@ -56,9 +56,9 @@ describe('nisemono', function() {
assert.ok(!TestHelper.isFakeFunc(fake.method3));
});
});
context('excepts&only', function() {
context('except&only', function() {
it('should return a fake object that has specified fake methods', function() {
var fake = nisemono.obj(obj, { only: ['method1', 'method2'], excepts: ['method1'] });
var fake = nisemono.obj(obj, { only: ['method1', 'method2'], except: ['method1'] });

assert.ok(TestHelper.isFunc(obj.method1));
assert.ok(TestHelper.isFunc(obj.method2));
Expand Down

0 comments on commit 283af24

Please sign in to comment.