Minitest/spec: must_include backwards?


#1

Hello,

In minitest/spec (version 1.3.0), the must_include assertion is
backwards:

require ‘rubygems’
require ‘minitest/spec’
MiniTest::Unit.autorun

describe ‘foo’ do
it ‘bar’ do
5.must_include [5] # <== passes
[5].must_include 5 # <== fails
end
end

I want to write:

list.must_include(item)

not:

item.must_include(list)

Is this a known bug/feature?

Thanks for your consideration.


#2

Suraj K. wrote:

In minitest/spec (version 1.3.0),
the must_include assertion is backwards:

require ‘rubygems’
require ‘minitest/spec’
MiniTest::Unit.autorun

describe ‘foo’ do
it ‘bar’ do
5.must_include [5] # <== passes
[5].must_include 5 # <== fails
end
end

minitest 1.3.1 fixes this problem and both assertions pass.