[rspec-users] Expecting nil or false

Fernando Perez lists at ruby-forum.com
Tue Mar 31 13:54:22 EDT 2009


> What is the full expression? i.e. what is it that should be false (or 
> nil)?

Basically:

def is_it_cool?
  find(blabla, :conditions => 'coolness > 1000')
end

In order to stay consistent and as the question mark suggests that true 
or false will be returned, I have updated my method too:

def is_it_cool?
  !!find(...)
end


Is true that the dynamic aspect of Ruby allows us to not have to 
statically type the return value of a method, so it could be an object, 
nil or a boolean.

What do you think?
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list