module Questions
Reflective questions for situational awareness.
Constants
- PHONE_REGEX
Simple regex that looks for ###.#### or ###-####
Public Instance Methods
contactform_available?()
click to toggle source
TODO: build better conditional to prevent false positives.
There could be other forms like newsletter signup, etc.
If there is a form with more than one field, this returns true. Forms with one field are typically search boxes.
Boolean, returns true if form is present on page.
# File lib/gimme_poc/questions.rb, line 24 def contactform_available? !(@page.forms.select { |x| x.fields.length > 1 }.empty?) end
email_available?()
click to toggle source
Boolean, returns true if email is present.
# File lib/gimme_poc/questions.rb, line 7 def email_available? !link_with_href('mailto').nil? end
phone_available?()
click to toggle source
Boolean, returns true if phone number is present.
# File lib/gimme_poc/questions.rb, line 12 def phone_available? !(@page.body =~ PHONE_REGEX).nil? end