Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Improved error messages for toHaveAttr, will address issue # 184 #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Improved error messages for toHaveAttr, will address issue # 184 #187

wants to merge 2 commits into from

Conversation

jesperronn
Copy link

...use of failure.

Different error messages if

  • element not found
  • attribute not found
  • incorrect attribute value

See issue #184

… cause of failure.

Different error messages if

 * element not found
 * attribute not found
 * incorrect attribute value

See issue #184
@jesperronn
Copy link
Author

Please let me know if this is the way we want to present error messages, and I can modify some more matchers.

In my opinion, it makes it much easier -- and faster -- to find errors.

One caveat: I don't know how I can actually write tests that verify text displayed when failures. Can somebody help out?

(I added tests in the bottom in and xdescribe() block so that the build wouldn't fail

@jesperronn
Copy link
Author

@RLovelett, I think your suggestion is great :) +1

@travisjeffery
Copy link
Collaborator

this looks fine to me, but i think all the relevant matchers should be consistent. do you mind updating them all to be the same? also i wouldn't worry about testing what message is shown since it won't really help much imo.

@jesperronn
Copy link
Author

@travisjeffery Totally agree that mactchers should behave consistently, and therefore all matchers should be fixed. Also, I may want more eyes on the nature of my suggested fix in this pull-request. For my taste, it's a lot of code and if statements.

Perhaps somebody has suggestions to make it leaner and prettier?

@willprice willprice mentioned this pull request Aug 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants