Class: Webrat::Locators::AreaLocator

Inherits:
Locator show all
Defined in:
lib/webrat/core/locators/area_locator.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Locator

#initialize, #locate!

Constructor Details

This class inherits a constructor from Webrat::Locators::Locator

Instance Method Details

#area_elementObject



12
13
14
15
16
17
# File 'lib/webrat/core/locators/area_locator.rb', line 12

def area_element
  area_elements.detect do |area_element|
    Webrat::XML.attribute(area_element, "title") =~ matcher ||
    Webrat::XML.attribute(area_element, "id") =~ matcher
  end
end

#area_elementsObject



23
24
25
# File 'lib/webrat/core/locators/area_locator.rb', line 23

def area_elements
  Webrat::XML.xpath_search(@dom, Area.xpath_search)
end

#error_messageObject



27
28
29
# File 'lib/webrat/core/locators/area_locator.rb', line 27

def error_message
  "Could not find area with name #{@value}"
end

#locateObject



8
9
10
# File 'lib/webrat/core/locators/area_locator.rb', line 8

def locate
  Area.load(@session, area_element)
end

#matcherObject



19
20
21
# File 'lib/webrat/core/locators/area_locator.rb', line 19

def matcher
  /#{Regexp.escape(@value.to_s)}/i
end