Take advantage of Ruby's dynamic nature to make future additions for TwiML nouns and verbs tests a little easier. Calling #has_foo? or #has_foo?("bar") for any foo will now just work. When passed "bar", the default behaviour is to do a substring match on the element's .inner_text property. If an exact match is needed as the case was/is with #has_play?, a class call to #has_element will be necessary. e.g.:
has_element "Foo", :exact_inner_match => true
This will create #has_foo?(inner) using an exact match.
There is also a has_bar_on_foo?(bat) pattern where bar can either be the equivalent of TwiML-style lowercase camelCase attributes, or a Ruby snake_case. The following two calls are same:
Take advantage of Ruby's dynamic nature to make future additions for TwiML nouns and verbs tests a little easier. Calling
#has_foo?
or#has_foo?("bar")
for anyfoo
will now just work. When passed"bar"
, the default behaviour is to do a substring match on the element's.inner_text
property. If an exact match is needed as the case was/is with#has_play?
, a class call to#has_element
will be necessary. e.g.:This will create
#has_foo?(inner)
using an exact match.There is also a
has_bar_on_foo?(bat)
pattern where bar can either be the equivalent of TwiML-style lowercase camelCase attributes, or a Ruby snake_case. The following two calls are same:... which will check for:
Care was taken to preserve the previous behaviour of the has_nnnn? methods.