Reputation: 4794
I am testing a page with a form that has two components - There are identical labeled fields in each section. With Capybara, I want to ensure that not only is there a "Name" field on the page (should have_field "Name"), but that there are, in fact, two of them.
Obviously, I can do this with xpath, but that's not the optimal solution. Is there a better way to handle this built into either Capybara or Rspec?
Upvotes: 0
Views: 840
Reputation: 11198
I think this is what you are looking for, see the docs. For example:
all('a').each { |a| a[:href] }
Upvotes: 0