开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜