Skip to content

Commit

Permalink
fixed a bug with falsy topics
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 26, 2010
1 parent 335a8ee commit ae16916
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vows/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ this.Suite.prototype = new(function () {
// If this context has a topic, store it in `lastTopic`,
// if not, use the last topic, passed down by a parent
// context.
if (topic) {
if (typeof(topic) !== 'undefined') {
lastTopic = topic;
} else {
old = true;
Expand Down
7 changes: 7 additions & 0 deletions test/vows-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ vows.describe("Vows").addBatch({
assert.equal(topic, 45);
}
},
"A non-function topic with a falsy value": {
topic: 0,

"should work as expected": function (topic) {
assert.equal(topic, 0);
}
},
"A topic returning a function": {
topic: function () {
return function () { return 42 };
Expand Down

0 comments on commit ae16916

Please sign in to comment.