[rspec-users] "should.be_in [values]" and "each_should_satisfy"

David Chelimsky dchelimsky at gmail.com
Tue Feb 13 19:28:00 EST 2007


PPS - s/right/write

On 2/13/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> PS - you can do that now if you're a trunkster.
>
> On 2/13/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> > On 2/13/07, Esad Hajdarevic <esad at esse.at> wrote:
> > > Hi!
> > >
> > > I just started using RSpec and have some question that I couldn't find
> > > answers to.
> > >
> > > If I have a result that can have two valid values, is there a better way
> > > of writing
> > > the following assertion?
> > >
> > > [value1,value2].should_include actual
> >
> > No, but you'll soon (0.8) be able to write your own custom expectation
> > matchers. So you'd be able to write, for example:
> >
> > actual.should be_in(value1,value2)
> >
> > >
> > > Is there a more elegant way of performing should_satisfy on a
> > > collection, for
> > > example I currently use something like collection.each {|x|
> > > x.should_satisfy {|x| ... } }
> > > which is very ugly. Is there something like each_should_satisfy?
> >
> > There's not. Again, when 0.8 is released you'll be able to right this
> > yourself. Probably something like:
> >
> > collection.should satisfy_for_each { |x| ... }
> >
> > Coming soon....
> >
> > Cheers,
> > David
> >
> >
> > >
> > > Thanks,
> > >
> > > Esad
> > >
> > > _______________________________________________
> > > rspec-users mailing list
> > > rspec-users at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/rspec-users
> > >
> >
>


More information about the rspec-users mailing list