Re: ruby and true
- From: Robert Klemme <shortcutter@xxxxxxxxxxxxxx>
- Date: Mon, 30 Apr 2007 17:29:29 +0200
On 30.04.2007 16:42, aidy.lewis@xxxxxxxxxxxxxx wrote:
Hi,
I have some code the checks whether some text is on the HTML page
@@log.test_results(ie.contains_text('Dashboard')
I should get a TRUE (it's there), but it is returning the figure 62.
Is anything > 0 in Ruby true? If so, why, and shouldn't the object
automatically change to boolean?
My xml then is falling through
if result == TRUE then
test_status = @test.add_element 'teststatus'
test_status.text = 'PASS'
There's only two falses in Ruby: false and nil. Everything else is considered true.
Please note also, that it is usually a very bad idea to try to compare a boolean value with a boolean constant in a boolean context. Just use the value or use "!" or "not" to negate. This applies to all sorts of programming languages (just think of doing "if ( x == TRUE )" in C...
Kind regards
robert
.
- Follow-Ups:
- Re: ruby and true
- From: Paul Rogers
- Re: ruby and true
- References:
- ruby and true
- From: aidy . lewis
- ruby and true
- Prev by Date: Re: Ways to change the behavior of a block
- Next by Date: Re: Ways to change the behavior of a block
- Previous by thread: Re: ruby and true
- Next by thread: Re: ruby and true
- Index(es):
Relevant Pages
|