From 40e0272dff133beff8eb0eb36a0e8f4edb6fdd33 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 30 Nov 2008 00:38:05 -0500 Subject: [PATCH] Initialize Labels with a session refrence --- lib/webrat/core/field.rb | 2 +- lib/webrat/core/form.rb | 2 +- lib/webrat/core/label.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/webrat/core/field.rb b/lib/webrat/core/field.rb index a06fbe5..7d0e4eb 100644 --- a/lib/webrat/core/field.rb +++ b/lib/webrat/core/field.rb @@ -96,7 +96,7 @@ module Webrat 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 diff --git a/lib/webrat/core/form.rb b/lib/webrat/core/form.rb index c9963eb..6f64049 100644 --- a/lib/webrat/core/form.rb +++ b/lib/webrat/core/form.rb @@ -48,7 +48,7 @@ module Webrat 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 diff --git a/lib/webrat/core/label.rb b/lib/webrat/core/label.rb index 2508823..3cdd56a 100644 --- a/lib/webrat/core/label.rb +++ b/lib/webrat/core/label.rb @@ -7,8 +7,8 @@ module Webrat ".//label" end - def initialize(field, element) - @field = field + def initialize(session, element) + @session = session @element = element end