Works for me:
irb(main):010:0> require 'test/unit/assertions'
=> true
irb(main):011:0> include Test::Unit::Assertions
=> Object
irb(main):012:0> assert(true)
=> nil
irb(main):013: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:28: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:38:in
`_wrap_assertion
'
from c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:38:in `assert'
from (irb):13
irb(main):014:0>
At 05:08 PM 8/2/2005, Jonathan Kohl wrote:
I haven t been able to get assertions to work in IRB when using Watir
either. I do a require for both Watir and test::unit, but it gets into a
strange state. I wanted to do this for live demos, but have had to
hand-wave at this point, and then run a script that prints out the
assertions. Maybe someone else has a suggestion.
Out of curiosity, why do you want to do this in IRB instead of saving the
tests in test files?
-Jonathan
----------
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tuyet Cong-Ton-Nu
Sent: August 2, 2005 4:04 PM
To: [email protected]
Subject: [Wtr-general] Using Asserts
I still can t get Asserts commands to work in the irb.
I got all the require statements correctly (they return true), but here
are some asserts statements that don t give me back anything.
Maybe I don t know how to use them or decipher whether it s true or false:
irb(main):046:1> assert_true(ie.contains_text("none")
irb(main):047:2> assert_true(ie.contains_text("%%%none")
irb(main):048:3> rescue => e
irb(main):049:3> puts e
irb(main):050:3> I get nothing here! I expected it to fail since there is
no such text on my IE page
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_____________________
Bret Pettichord
www.pettichord.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general