[rspec-users] Testing for the number of occurrences of a word

aslak hellesoy aslak.hellesoy at gmail.com
Tue Mar 10 09:05:51 EDT 2009

On Tue, Mar 10, 2009 at 1:16 PM, Bart Zonneveld <zuperinfinite at gmail.com>wrote:

> Hey list,
> 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 &lts and &gts 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


> thanks!
> bartz
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090310/6fbb837e/attachment.html>

More information about the rspec-users mailing list