Ditching preloading of Webrat::Elements

This commit is contained in:
Bryan Helmkamp 2008-11-30 14:48:32 -05:00
parent d48a0fcb15
commit de2ba2caf8

View File

@ -30,9 +30,6 @@ module Webrat
def initialize(session, &block) #:nodoc: def initialize(session, &block) #:nodoc:
@session = session @session = session
instance_eval(&block) if block_given? instance_eval(&block) if block_given?
# preload
load_elements
end end
# Verifies an input field or textarea exists on the current page, and stores a value for # Verifies an input field or textarea exists on the current page, and stores a value for
@ -282,14 +279,6 @@ module Webrat
protected protected
def load_elements
labels
fields
forms
areas
links
end
def page_dom #:nodoc: def page_dom #:nodoc:
return @response.dom if @response.respond_to?(:dom) return @response.dom if @response.respond_to?(:dom)
dom = Webrat::XML.document(@response_body) dom = Webrat::XML.document(@response_body)
@ -323,27 +312,9 @@ module Webrat
end end
end end
def areas #:nodoc:
@areas ||= Area.load_all(@session, dom)
end
def links #:nodoc:
@links ||= Link.load_all(@session, dom)
end
def forms #:nodoc: def forms #:nodoc:
@forms ||= Form.load_all(@session, dom) @forms ||= Form.load_all(@session, dom)
end end
def fields
@fields ||= Field.field_classes.map do |field_class|
field_class.load_all(@session, dom)
end.flatten
end
def labels
@labels ||= Label.load_all(@session, dom)
end
end end
end end