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

Change assertion subject when using ownProperty #281

Closed
lo1tuma opened this issue Jul 22, 2014 · 8 comments
Closed

Change assertion subject when using ownProperty #281

lo1tuma opened this issue Jul 22, 2014 · 8 comments

Comments

@lo1tuma
Copy link
Contributor

lo1tuma commented Jul 22, 2014

It would be nice if ownProperty changes the assertion subject in the same way as property does.

So you can do the following expectation:

expect(obj).to.have.ownProperty('foo')
  .that.is.a('string');
@keithamus
Copy link
Member

Although it is a backwards incompatible change, it could be worthy of adding. I'd like to hear what @logicalparadox has to say on the matter.

Leaving it open for further discussion.

@jasonkarns
Copy link
Contributor

I agree. The lack of symmetry between property and ownProperty is confusing.

@rhbecker
Copy link

+1 ... and while on the topic, why not also support an optional second value argument?

@keithamus
Copy link
Member

Yup. You are all right. We should:

  • - Alter flag('object') to allow chaining, as per @lo1tuma's suggestion
  • - Allow a second value argument, as per @rhbecker's suggestion
  • - PR these both against the 4.x.x branch, as it will be a breaking change.

PRs are welcome for these features. If you need assistance let me know and I'll detail the steps needed for this.

@lucasfcosta
Copy link
Member

I'm planning on sending a PR for this today.
If someone was already working on this please let me know 😃

@sukrosono
Copy link
Contributor

am i correct that this should be close since 641 have been merged?

@keithamus
Copy link
Member

#641 was merged into the 4.x.x branch so this one wouldn't be closed by that. I'll close it manually as there is nothing more that needs doing for this issue - we just need to cut a 4.0.0 release soon to release it.

@Noitidart
Copy link

Is it possible to make .property not change the target subject?

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

No branches or pull requests

7 participants