[rspec-users] Can I do foo.should (be_nil || be_empty) in rspec

Andrew Premdas apremdas at gmail.com
Tue Nov 4 11:36:54 EST 2008

Ok I see. I was approaching this more from the syntax that my stories can
express rather than what my code does. However from these replies and a
re-read of the cucumber wiki I can see that any step that requires the
(foo||bar) construct is by definition a conjunction and can be broken into
smaller steps.
However we only have 'And' available in stories, do we need 'Or'?

All best


2008/11/4 Pat Maddox <pergesu at gmail.com>

> "Andrew Premdas" <apremdas at gmail.com> writes:
> > General case I'm thinking about is just testing that something should be
> one thing or another
> >
> >    e.g x.should be(foo || bar)
> >
> > Haven't got a specific example at the moment apart from the blank one.
>  What I'm thinking about is the syntax to say this in a spec, as I
> > think there must be lots of times when having this sort of syntax would
> be useful.
> Hi,
> This is a case where a custom matcher would be hiding a concept that
> belongs directly in your code.  If you really don't care about the
> difference between empty and nil, you should create a method - such as
> #blank? - that handles that for you.
> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081104/d0a5e365/attachment.html>

More information about the rspec-users mailing list