Skip to content

Commit

Permalink
Initialize Labels with a session refrence
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Nov 30, 2008
1 parent 9e743ea commit 40e0272
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/webrat/core/field.rb
Expand Up @@ -96,7 +96,7 @@ def escaped_value
end

def labels
@labels ||= label_elements.map { |element| Label.new(self, element) }
@labels ||= label_elements.map { |element| Label.new(@session, element) }
end

def label_elements
Expand Down
2 changes: 1 addition & 1 deletion lib/webrat/core/form.rb
Expand Up @@ -48,7 +48,7 @@ def fields

def labels
@labels ||= Webrat::XML.css_search(element, "label").map do |element|
label = Label.new(nil, element)
label = Label.new(@session, element)
@session.elements[Webrat::XML.xpath_to(element)] = label
label
end
Expand Down
4 changes: 2 additions & 2 deletions lib/webrat/core/label.rb
Expand Up @@ -7,8 +7,8 @@ def self.xpath_search
".//label"
end

def initialize(field, element)
@field = field
def initialize(session, element)
@session = session
@element = element
end

Expand Down

0 comments on commit 40e0272

Please sign in to comment.