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

Make it possible to require a single element to match all nested requirements. #76

Open
expeehaa opened this issue Mar 8, 2021 · 0 comments

Comments

@expeehaa
Copy link

expeehaa commented Mar 8, 2021

If the title is too hard to understand, please take a look at this example.

expect('<div><p>test</p></div><div><h2>test2</h2></div>').to have_tag('div') do 
  with_tag 'p' 
  with_tag 'h2' 
end

The string consists of 2 divs, where one has a p tag and the other one has a h2 tag.
Intuitively, I would expect the expectation to fail because the string does not have a div tag with tags p and h2.
However, it does not fail.

It would be great if there was an option to require all nested matchers to be true for a single element of the outer scope instead of being true for any element of the outer scope.

I might try to implement it myself and create a pull request.

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

1 participant