Quick question: How can I check that a given word appears a number of
times on a page?
The page in question includes some XML, rendered with <s and >s
and I want to test that a given node exists 10 times on that page.
Quick question: How can I check that a given word appears a number of times
on a page?
The page in question includes some XML, rendered with <s and >s and I
want to test that a given node exists 10 times on that page.
You want to make sure you have 10 nodes? Or that text shows up 10
times inside of any node?
You can utilize Webrat’s #have_selector to count the nodes, ie:
Quick question: How can I check that a given word appears a number of times
on a page?
The page in question includes some XML, rendered with <s and >s and I
want to test that a given node exists 10 times on that page.
Here are a couple of ways to do it:
count = # one of the solutions above
count.should == 10