[rspec-users] Expecting nil or false

David Chelimsky dchelimsky at gmail.com
Tue Mar 31 12:29:18 EDT 2009


On Tue, Mar 31, 2009 at 11:08 AM, Fernando Perez <lists at ruby-forum.com> wrote:
> Hi,
>
> I just ran into this issue. I have a method that returns: false, true,
> 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 everything
> 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?

No, but you may have to use different matchers. What are you using?

> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list