Skip to content

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

Open
@expeehaa

Description

@expeehaa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions