Oct 21

RSpec have_text vs include_text

The tutorial docs I’ve looked at don’t mention this, but there is a handy new test utility for your response objects.

response.should include_text("blah blah")

which tests to see if “blah blah” is anywhere on the page.

This compares favorably to

response.should have_text("blah blah")

which tests if the entire text of the page == “blah blah”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>