In Chapter 14, Bootstrapping Rails, we dabbled a little bit in Capybara’s API. We used the visit(path) method to go to a user’s page, and we verified that messages were displayed on the screen using Capybara’s have_content matcher. Let’s add a feature that will allow users to search for messages. This will expose us to more of the goodness Capybara has to offer.
Start with the code we left off with at the end of the previous chapter and add a new search feature to features/search.feature:
|||Scenario: Find messages by content|
|||Given a User has posted the following messages:|
|||| content ||
|||| I am making dinner ||
|||| I just woke up ||
|||| I ...|