From e317c19bd6de148fa138ee6231490f8fa8cb56ab Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Tue, 3 Nov 2015 13:53:24 -0500 Subject: [PATCH] Add another example of `Capybara.string` I read the existing document, but I was still having trouble with a single element (I was missing the `first('a')` part), so I thought another example would help someone else. --- lib/capybara.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/capybara.rb b/lib/capybara.rb index bd465206..70193b3a 100644 --- a/lib/capybara.rb +++ b/lib/capybara.rb @@ -140,7 +140,16 @@ module Capybara # in a {Capybara::Node::Simple} which exposes all {Capybara::Node::Matchers}, # {Capybara::Node::Finders} and {Capybara::Node::DocumentMatchers}. This allows you to query # any string containing HTML in the exact same way you would query the current document in a Capybara - # session. For example: + # session. + # + # Example: A single element + # + # node = Capybara.string('bar') + # anchor = node.first('a') + # anchor[:href] #=> 'foo' + # anchor.text #=> 'bar' + # + # Example: Multiple elements # # node = Capybara.string <<-HTML #