Class: Spec::Watir::HaveText
- Inherits:
-
Object
- Object
- Spec::Watir::HaveText
- Defined in:
- lib/spec/ui/watir_helper.rb
Overview
:nodoc
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(text_or_regexp) ⇒ HaveText
constructor
A new instance of HaveText.
- #matches?(browser) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(text_or_regexp) ⇒ HaveText
Returns a new instance of HaveText.
51 52 53 |
# File 'lib/spec/ui/watir_helper.rb', line 51 def initialize(text_or_regexp) @text_or_regexp = text_or_regexp end |
Instance Method Details
#failure_message ⇒ Object
64 65 66 |
# File 'lib/spec/ui/watir_helper.rb', line 64 def "Expected browser to have text matching #{@text_or_regexp}, but it was not found in:\n#{@browser.text}" end |
#matches?(browser) ⇒ Boolean
55 56 57 58 59 60 61 62 |
# File 'lib/spec/ui/watir_helper.rb', line 55 def matches?(browser) @browser = browser if @text_or_regexp.is_a?(Regexp) !!browser.text =~ @text_or_regexp else !!browser.text.index(@text_or_regexp.to_s) end end |
#negative_failure_message ⇒ Object
68 69 70 |
# File 'lib/spec/ui/watir_helper.rb', line 68 def "Expected browser to not have text matching #{@text_or_regexp}, but it was found in:\n#{@browser.text}" end |