Undefined local variable

I use watir in Radrails for testing my app. Iuse 2 classes in my test,
where is used variable @ie. Here are their code
First class:

class Title
def initialize(title,url,ie)
@title = title
@url=url
@ie=ie
@ie=Watir::IE.attach(:title, @title)
rescue Watir::Exception::NoMatchingWindowFoundException
puts ("could not find browser")
$r.addtoReport(testReport, "check page element", "FAILED", "Page

title " + @title +" not found")
else
@ie=Watir::IE.attach(:url, @url)
end
end

Second class:

class Text_pos
def initialize(text, object,ie)
@text=text
@object=object
@ie=ie
if @ie.contains_text(@text)
puts("Test for " + @object + " passed")
$r.addtoReport($testReport, "check " + @object, "PASSED", "Test for

" + @object + " passed" )
else
puts(“Test for " + @object + " failed”)
puts (@ie.link(:text => /Exception:/))
h= @ie.link(:text => /Exception:/)
$r.addtoReport($testReport, "check " + @object, “FAILED”, h.text)
end
end
end
After in test body i executed such commands:

Text_pos.new("Glossary Of Terms", "login",ie)
Title.new("Company","http://ec2-50-16-62-110.compute-1.amazonaws.com:9100/bobsworld/BPM/Mtebpm000p0001Form.do?resetFilter_action=",

ie1)
Text_pos.new(“Title”, “if page is loaded”, ie1)
But get error - Test for login passed BPM/try.rb:106:in': undefined local variable or method ie1' for main:Object (NameError)
If i do not use class Title this Text_pos.new(“Title”, “if page is
loaded”, ie1) works ok.

you should first learn how ruby works before you use rails

you never defined your “ie1” variable in your code!

On Thu, Jul 12, 2012 at 11:14 AM, Hans M. [email protected]
wrote:

i should first learn how ruby works before you use rails

you never defined your “ie1” variable in your code!

Also the sequence

@ie=ie
@ie=Watir::IE.attach(:title, @title)

in class Title is dysfunctional: Argument ie is completely superfluous
and can be removed since it is only written to @ie and @ie is
overwritten immediately afterwards.

Kind regards

robert