Now that you can navigate around your application, submit forms, and locate any element in the DOM, we need to turn our attention to validating the expected behavior.
Capybara allows us to do this in a couple of ways.
The first option is to use the Capybara "Query" API directly. Capybara provides a whole set of methods for querying the page under test and returning a Boolean value.
page.has_content? 'capybara rocks' page.has_selector? '#main'
You could use these methods with a traditional "assertion" approach where tests assert against a Boolean condition. The other option is to use RSpec "Magic Matchers". These matchers in fact just "piggy back" off the query methods:
page.should have_content 'capybara rocks' page.should have_selector ...