Testing Array membership in rspec
I'd like to test whether or not an array contains a given object.
I suppose I co开发者_StackOverflowuld accomplish this with
some_array.index(object).should be_a_kind_of(Integer)
or
some_array.index(object).should_not be_nil
or
some_array.include?(object).should be_true
However, I'm hoping there's a more elegant way to express this, something like
some_array.should include(object)
but, you know, valid code. Is there?
精彩评论