[rspec-users] Expecting nil or false
aslak.hellesoy at gmail.com
Tue Mar 31 12:48:28 EDT 2009
Den 31. mars. 2009 kl. 18.34 skrev "Colfer, Brian"
<bcolfer at shopping.com>:
> What about variable.nil? == true
No, that will not raise anything.
x.should == nil
Ditto for false and true.
What have you been trying?
> Sent from Brian's iPhone
> On Mar 31, 2009, at 9:26 AM, "Fernando Perez" <lists at ruby-forum.com>
>> I just ran into this issue. I have a method that returns: false,
>> nil or an object.
>> This method is used by another method to test for true/false. In Ruby
>> that's easy to handle as nil and false evaluate to false, and
>> else evaluates to true, but RSpec seems to expect an exact value
>> such as
>> nil, true, false, not_nil, etc.
>> Do I have to rewrite my return values to always return true or false?
>> Posted via http://www.ruby-forum.com/.
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users