I am pretty sure your class need to inherit from Test::Unit::TestCase
(if that is the right way to say it).

class MyStuff < Test::Unit::TestCase
  def verifyAndGo(linkName)
    assert($ie.link(:text, linkName).exists?)
    $ie.link(:text, linkName).click
  end
end

--Mark


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven List
Sent: Thursday, March 08, 2007 1:13 PM
To: wtr-general@rubyforge.org
Subject: [Wtr-general] Assert in helper class in require'd file

At the moment, WATIR is kicking my butt in a small way.

I want to use an assert() inside a class that is require'd by a test
class.

So it's
===========================================
require 'includeFirst'

$x = MyStuff.new

class TC_blah
    def test_blah
        $x.verifyAndGo("blah")
    end
end
========================================

and inside includeFirst.rb

========================================
require 'watir'
require 'test/unit'

class MyStuff
  def verifyAndGo(linkName)
    assert($ie.link(:text, linkName).exists?)
    $ie.link(:text, linkName).click
  end
end
========================================

When I try to execute it, it tells me that it can't find assert.

  1) Error:
test_001_clientSearchLinkExists(TC_ClientAdmin): NoMethodError:
undefined method `assert' for #<OnrLib:0x2d86c2c>
    ./includeFirst.rb:32:in `verifyAndGoToLink'
    Z:/.../WATIR tests/clientAdmin-nu.rb:26:in
`test_001_clientSearchLinkExists'

I'm sure this is dead simple, but it's got me stumped at the moment.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6835&messageID=19701#19701
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to