17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ae_page_objects/core/application_router.rb', line 17
def recognizes?(path, url)
["GET", "PUT", "POST", "DELETE", "PATCH"].map(&:downcase).map(&:to_sym).each do |method|
path_route_result = ActionController::Routing::Routes.named_routes[path].requirements
recognized_result = nil
begin
recognized_result = ActionController::Routing::Routes.recognize_path(url, {:method => method}).select do
|key, _|
key.to_s.match(/(controller|action)/)
end
rescue ActionController::MethodNotAllowed
end
if recognized_result && path_route_result == Hash[recognized_result]
return true
else
next
end
end
false
end
|