I guess this is from some old user guide (I could not find it in the current
one).

ie.contains_text returns number if text is found

irb> ie.contains_text("text")
=> 11

and assert returns nil if you give it a number

irb(main):011:0> assert(11)
=> nil

This combines it.

irb(main):013:0> assert(ie.contains_text("text"))
=> nil

So, you are saying

if nil
 puts("Test passed.")
else
 puts("Test failed!")
end

And, of course, it will always print "Test failed!".

If you really want to use assert and print "Test passed." after it passes
you can do it like this:

assert(ie.contains_text("text"))
puts("Test passed.")

If assertion passes, it will print "Test passed.", and if does not pass, it
will raise exception, and "Test passed." will not be printed.
--
Zeljko Filipin
zeljkofilipin.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to