Class: Spec::Watir::HaveHtml
- Inherits:
-
Object
- Object
- Spec::Watir::HaveHtml
- Defined in:
- lib/spec/ui/watir_helper.rb
Overview
:nodoc
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(text_or_regexp) ⇒ HaveHtml
constructor
A new instance of HaveHtml.
- #matches?(browser) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(text_or_regexp) ⇒ HaveHtml
Returns a new instance of HaveHtml.
79 80 81 |
# File 'lib/spec/ui/watir_helper.rb', line 79 def initialize(text_or_regexp) @text_or_regexp = text_or_regexp end |
Instance Method Details
#failure_message ⇒ Object
92 93 94 |
# File 'lib/spec/ui/watir_helper.rb', line 92 def "Expected browser to have HTML matching #{@text_or_regexp}, but it was not found in:\n#{@browser.html}" end |
#matches?(browser) ⇒ Boolean
83 84 85 86 87 88 89 90 |
# File 'lib/spec/ui/watir_helper.rb', line 83 def matches?(browser) @browser = browser if @text_or_regexp.is_a?(Regexp) !!browser.html =~ @text_or_regexp else !!browser.html.index(@text_or_regexp.to_s) end end |
#negative_failure_message ⇒ Object
96 97 98 |
# File 'lib/spec/ui/watir_helper.rb', line 96 def "Expected browser to not have HTML matching #{@text_or_regexp}, but it was found in:\n#{@browser.html}" end |