you need to 'load up' the assertions libraries
the following shows you how
C:\cygwin>irb
irb(main):001:0> require 'test/unit/assertions'
=> true
irb(main):002:0> include Test::Unit::Assertions
=> Object
irb(main):003:0> assert( true )
=> nil
irb(main):004:0> assert(false)
Test::Unit::AssertionFailedError: <false> is not true.
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:30:in `assert_block'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:359:in
`_wrap_assertion'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:28:in `assert_block'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:40:in `assert'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:354:in
`_wrap_assertion'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `assert'
from (irb):4
irb(main):005:0>
----- Original Message -----
From: Kui Zhang <[EMAIL PROTECTED]>
Date: Wednesday, May 23, 2007 11:28 am
Subject: Re: [Wtr-general] Why it is always failed?
> Hi Zeljko,
>
> Thank you the reply!
>
> I found one of your reply for the assertion in another email and
> that helped with my problem. Here is the code I had before and it
> always failed.
> begin
> assert(ie.frame(:name, "top_frame").contains_text("ClaimCenter"))
> puts ("Test Passed. Found folder 'ClaimCenter'")
>
> rescue => e
> puts("TEST FAILED. Cannot find folder 'ClaimCenter'")
> end
>
> I removed the rescure... and it works now:
>
> begin
> assert(ie.frame(:name, "top_frame").contains_text("ClaimCenter"))
> puts ("Test Passed. Found folder 'ClaimCenter'")
> end
>
>
> Have one question for you. When using assert in irb, it gives me
> NoMethodError. I did require 'Watir', should I be able to use
> assert in this case?
>
> irb(main):006:0> assert(ie.contains_text('iGoogle'))
> NoMethodError: undefined method `assert' for #<Object:0x28cfa30>
>
> Really appreciate your help!
>
> Kui
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general