Class: Webrat::Selenium::Matchers::HaveSelector
- Defined in:
- lib/webrat/selenium/matchers/have_selector.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#failure_message ⇒ Object
Returns String:: The failure message.
-
#initialize(expected) ⇒ HaveSelector
constructor
A new instance of HaveSelector.
- #matches?(response) ⇒ Boolean
-
#negative_failure_message ⇒ Object
Returns String:: The failure message to be displayed in negative matches.
Constructor Details
#initialize(expected) ⇒ HaveSelector
Returns a new instance of HaveSelector.
5 6 7 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 5 def initialize(expected) @expected = expected end |
Instance Method Details
#failure_message ⇒ Object
Returns
- String
-
The failure message.
19 20 21 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 19 def "expected following text to match selector #{@expected}:\n#{@document}" end |
#matches?(response) ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 9 def matches?(response) response.session.wait_for do response.selenium.is_element_present("css=#{@expected}") end rescue Webrat::TimeoutError false end |
#negative_failure_message ⇒ Object
Returns
- String
-
The failure message to be displayed in negative matches.
25 26 27 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 25 def "expected following text to not match selector #{@expected}:\n#{@document}" end |