Skip to content

Commit

Permalink
Fixed backwards negation messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
whatthejeff committed Feb 2, 2013
1 parent 02ed69e commit 4033c14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ module.exports = function (chai, _) {
this.assert(
len >= n
, 'expected #{this} to have a length at least #{exp} but got #{act}'
, 'expected #{this} to not have a length below #{exp}'
, 'expected #{this} to have a length below #{exp}'
, n
, len
);
Expand Down Expand Up @@ -593,7 +593,7 @@ module.exports = function (chai, _) {
this.assert(
len <= n
, 'expected #{this} to have a length at most #{exp} but got #{act}'
, 'expected #{this} to not have a length above #{exp}'
, 'expected #{this} to have a length above #{exp}'
, n
, len
);
Expand Down
8 changes: 8 additions & 0 deletions test/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ suite('expect', function () {
err(function () {
expect([ 1, 2, 3 ]).to.have.length.of.at.least(4, 'blah');
}, "blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3");

err(function () {
expect([ 1, 2, 3, 4 ]).to.not.have.length.of.at.least(4, 'blah');
}, "blah: expected [ 1, 2, 3, 4 ] to have a length below 4");
});

test('below(n)', function(){
Expand Down Expand Up @@ -237,6 +241,10 @@ suite('expect', function () {
err(function () {
expect([ 1, 2, 3 ]).to.have.length.of.at.most(2, 'blah');
}, "blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3");

err(function () {
expect([ 1, 2 ]).to.not.have.length.of.at.most(2, 'blah');
}, "blah: expected [ 1, 2 ] to have a length above 2");
});

test('match(regexp)', function(){
Expand Down

0 comments on commit 4033c14

Please sign in to comment.