[rspec-users] be_none and be_any don't seem to work properly

iain iain at iain.nl
Mon Oct 19 15:12:43 EDT 2009

Hi all!

I'm testing some named scopes. I use be_all(&:some_predicate) to test
if all the elements in the collection are valid, which works, but when
I try to test the inverse, it fails.

You can see the complete code at: http://gist.github.com/213636

But in short:

subject = User.active
subject.should be_all(&:active) # works

inverse = User.all - subject
inverse.none?(&:active).should be_true # works
inverse.should be_none(&:active) # doesn't work

And also "inverse.should_not be_any(&:active)" doesn't work either

And I cannot figure out why. The RDoc of rspec or rspec-rails don't
mention be_none or be_any, so I would think that this would be
straightforward. Anyone any ideas?

Thanks in advance,
Iain - iain.nl

More information about the rspec-users mailing list