[Rspec-devel] support for arbitrary comparisons

David Chelimsky dchelimsky at gmail.com
Wed Sep 6 11:23:58 EDT 2006


On 9/6/06, Jay Levitt <lists-rspec at shopwatch.org> wrote:
> David Chelimsky wrote:
> > This patch also supports using methods that are not formatted like
> > predicates but act like them:
> >
> > def whatever
> >   true
> > end
> >
> > subject.should_be_whatever
> >
> > I really object to this on philosophical grounds.
>
> This is so simple that I don't understand it... how/why would I use that
> in a real spec?

RSpec supports arbitrary predicates - any ruby method formatted with a
"?" at the end that returns boolean. I use this for things like:

collection.should_be_empty

I do use that periodically, and I think that it is nicer than this:

collection.empty?.should_be true

David

>
> Jay
>
>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>


More information about the Rspec-devel mailing list