O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing a Simple Search Without Ajax

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:

 Feature​: Search
 Scenario​: Find messages by content
 Given a User has posted the following messages​:
  | content |
  | I am making dinner |
  | I just woke up |
  | I ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required