Class: Webrat::Locators::TableLocator
- Defined in:
- lib/cucumber/webrat/table_locator.rb
Instance Method Summary collapse
- #error_message ⇒ Object
- #locate ⇒ Object
- #matches_css_selector?(table_element) ⇒ Boolean
- #matches_id?(table_element) ⇒ Boolean
- #table_element ⇒ Object
- #table_elements ⇒ Object
Instance Method Details
#error_message ⇒ Object
47 48 49 |
# File 'lib/cucumber/webrat/table_locator.rb', line 47 def "Could not find table matching '#{@value}'" end |
#locate ⇒ Object
24 25 26 |
# File 'lib/cucumber/webrat/table_locator.rb', line 24 def locate Table.load(@session, table_element) end |
#matches_css_selector?(table_element) ⇒ Boolean
39 40 41 |
# File 'lib/cucumber/webrat/table_locator.rb', line 39 def matches_css_selector?(table_element) Webrat::XML.css_at(@dom, @value) end |
#matches_id?(table_element) ⇒ Boolean
35 36 37 |
# File 'lib/cucumber/webrat/table_locator.rb', line 35 def matches_id?(table_element) Webrat::XML.attribute(table_element, "id") == @value.to_s end |
#table_element ⇒ Object
28 29 30 31 32 33 |
# File 'lib/cucumber/webrat/table_locator.rb', line 28 def table_element table_elements.detect do |table_element| matches_id?(table_element) || matches_css_selector?(table_element) end end |
#table_elements ⇒ Object
43 44 45 |
# File 'lib/cucumber/webrat/table_locator.rb', line 43 def table_elements Webrat::XML.xpath_search(@dom, *Table.xpath_search) end |