Minitest/spec: must_include backwards?

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.

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs