Method: Celerity::TextField#contains_text

Defined in:
lib/celerity/elements/text_field.rb

#contains_text(expected_text) ⇒ Object

Check if the given text fields contains the given String or Regexp.



107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/celerity/elements/text_field.rb', line 107

def contains_text(expected_text)
  assert_exists

  case expected_text
  when Regexp
    value() =~ expected_text
  when String
    value().index(expected_text)
  else
    raise TypeError, "expected String or Regexp, got #{expected_text.inspect}:#{expected_text.class}"
  end
end