Skip to content

Commit

Permalink
better test for object property iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
rmurphey committed Apr 12, 2012
1 parent 8db0280 commit a3b3772
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/app/objects.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ define([ 'use!underscore' ], function(_) {
expect(new C('Ellie').greeting).to.be(greeting); expect(new C('Ellie').greeting).to.be(greeting);
}); });


it("you should be able to iterate over an object's properties", function() { it("you should be able to iterate over an object's 'own' properties", function() {
// define a function for fn so that the following will pass // define a function for fn so that the following will pass
var obj = { var C = function() {
foo : 'bar', this.foo = 'bar';
baz : 'bim' this.baz = 'bim';
}; };


expect(fn()).to.eql([ 'foo: bar', 'baz: bim' ]); C.prototype.bop = 'bip';

var obj = new C();

expect(fn(obj)).to.eql([ 'foo: bar', 'baz: bim' ]);
}); });
}); });
}); });

0 comments on commit a3b3772

Please sign in to comment.