Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contain/include bug introduced in v1.9 #239

Closed
adambiggs opened this issue Jan 31, 2014 · 4 comments
Closed

contain/include bug introduced in v1.9 #239

adambiggs opened this issue Jan 31, 2014 · 4 comments

Comments

@adambiggs
Copy link

After upgrading from v1.8.1 to v1.9, I noticed a failed assertion when testing that an array contains an object instance.

Example:

var obj = { foo: 'bar' };
var arr = [ obj ];

arr.should.contain(obj);
// AssertionError: expected [ { foo: 'bar' }, unique: [Function] ] to have a property 'foo'

Seems like a breaking change with contain/include assertions, but I couldn't find any mention of it in the changelog.

@vesln
Copy link
Member

vesln commented Feb 1, 2014

Confirmed. On top of my head I can tell that #230 was touching include/contain, but not sure it's causing the issue. Regardless the root cause, it should be fixed and a new version will be released. Thanks for letting us know! I'll keep you posted

@kirill-konshin
Copy link

The solution can be (file assertions.js):

// change from
if (_.type(val) === 'object') {
// to
if (_.type(val) === 'object' && _.type(obj) !== 'array') {

@lo1tuma
Copy link
Contributor

lo1tuma commented Mar 10, 2014

I have the same problem.
Does #244 fix this issue? If so, can you release a patched version on npm?

@logicalparadox
Copy link
Member

Released in 1.9.1. View release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants