Minitest 5 update

Ken Dreyer ktdreyer at ktdreyer.com
Fri Mar 21 16:39:12 UTC 2014


On Fri, Mar 21, 2014 at 10:18 AM, Mamoru TASAKA
<mtasaka at fedoraproject.org> wrote:
> Note that some packages (I maintain) already requires minitest 5 for
> testsuite (and
> currently I have to revert changes), e.g.
>
> http://pkgs.fedoraproject.org/cgit/rubygem-net-http-persistent.git/commit/?id=6f97361782c74f5da3117bc66fe1f2d3a6215b4d
> http://pkgs.fedoraproject.org/cgit/rubygem-mechanize.git/commit/?id=59b668ecaeef6fc29744ea7dbecbc2869df0ad47
> http://pkgs.fedoraproject.org/cgit/rubygem-hoe.git/commit/?id=eade41e72919f254325755bfcb940ca0d44a5e71


rubygem-escape_utils (not yet in Fedora) was also converted upstream
to Minitest 5. Here's what I used in %prep to switch back to the old
Minitest 4 syntax:

# Get the major version number of the Minitest gem
minitest=$(ruby -r 'minitest/unit' \
  -e "puts Minitest::Unit::VERSION.split('.')[0]")
if [ $minitest > 5 ]; then
  # Conditionally correct Minitest usage, for Minitest versions < 5.0.0.
  # For example, at least Fedora 20 has Minitest 4.x.
  for f in $(find test -type f); do
    sed -i "s/Minitest::Test/Minitest::Unit::TestCase/g" $f
  done
fi

This should be forward-compatible with Minitest 5 when it lands in Fedora 21.

- Ken


More information about the ruby-sig mailing list