For ex: a.text has name "capybara" and I need to check whether the string has characters "ba" in it.
if a.text.contains?("ba")
# do something
else
# do something
end
text = "capybara"
text.include?("ba")
=> true
so you could do:
if text.include?("ba")
# do something
else
# do something else
end
If you want more flexibility with regex, use match
like:
if a.text.match(/ba/)
# do something
end
Capybara
? is this in a capybara rspec feature test? Or just plain ruby?