[rubygem-hashr] Fix test suite to run with minitest 5

Josef Stribny jstribny at fedoraproject.org
Mon Jul 7 10:48:15 UTC 2014


commit d7a668cb436a7f03b96eb343a12aa803f80b25b6
Author: Josef Stribny <jstribny at redhat.com>
Date:   Mon Jul 7 12:48:21 2014 +0200

    Fix test suite to run with minitest 5

 rubygem-hashr-minitest5.patch |   44 +++++++++++++++++++++++++++++++++++++++++
 rubygem-hashr.spec            |   20 +++++++++---------
 2 files changed, 54 insertions(+), 10 deletions(-)
---
diff --git a/rubygem-hashr-minitest5.patch b/rubygem-hashr-minitest5.patch
new file mode 100644
index 0000000..2e61b5a
--- /dev/null
+++ b/rubygem-hashr-minitest5.patch
@@ -0,0 +1,44 @@
+diff --git a/test/core_ext_test.rb b/test/core_ext_test.rb
+index 11023e8..f2fc0f7 100644
+--- a/test/core_ext_test.rb
++++ b/test/core_ext_test.rb
+@@ -1,6 +1,6 @@
+ require 'test_helper'
+ 
+-class CoreExtTest < Test::Unit::TestCase
++class CoreExtTest < Minitest::Test
+   test 'Hash#deep_symbolize_keys walks arrays, too' do
+     hash     = { 'foo' => [{ 'bar' => 'bar', 'baz' => { 'buz' => 'buz' } }] }
+     expected = { :foo  => [{ :bar  => 'bar', :baz  => { :buz  => 'buz' } }] }
+diff --git a/test/hashr_test.rb b/test/hashr_test.rb
+index 4a172c2..ff03bad 100644
+--- a/test/hashr_test.rb
++++ b/test/hashr_test.rb
+@@ -1,12 +1,12 @@
+ require 'test_helper'
+ 
+-class HashrTest < Test::Unit::TestCase
++class HashrTest < Minitest::Test
+   def teardown
+     Hashr.raise_missing_keys = false
+   end
+ 
+   test 'initialize takes nil' do
+-    assert_nothing_raised { Hashr.new(nil) }
++    Hashr.new(nil)
+   end
+ 
+   test 'method access on an existing key returns the value' do
+diff --git a/test/test_helper.rb b/test/test_helper.rb
+index 67dd321..ceddc1d 100644
+--- a/test/test_helper.rb
++++ b/test/test_helper.rb
+@@ -1,4 +1,4 @@
+ require 'bundler/setup'
+-require 'test/unit'
++require 'minitest/autorun'
+ require 'test_declarative'
+ require 'hashr'
+-- 
+1.8.3.1
+
diff --git a/rubygem-hashr.spec b/rubygem-hashr.spec
index 5b25ca2..252d2ac 100644
--- a/rubygem-hashr.spec
+++ b/rubygem-hashr.spec
@@ -10,25 +10,21 @@
 Summary: Simple Hash extension to make working with nested hashes
 Name: rubygem-%{gem_name}
 Version: 0.0.22
-Release: 5%{?dist}
+Release: 6%{?dist}
 Group: Development/Languages
 License: MIT
 URL: http://github.com/svenfuchs/hashr
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
+Patch0: rubygem-hashr-minitest5.patch
 Requires: rubygems
-%if 0%{?rhel} == 6 || 0%{?fedora} < 17
 Requires: ruby(release)
-%else
-Requires: ruby(release)
-%endif
 %if 0%{?fedora}
 BuildRequires: rubygems-devel
 %endif
 BuildRequires: rubygems
 
-%if 0%{?fedora} > 16
-BuildRequires: rubygem(minitest)
-# test_declarative is only in F17+
+%if 0%{?fedora}
+BuildRequires: rubygem(minitest) >= 5.0.0
 BuildRequires: rubygem(test_declarative)
 %endif
 
@@ -81,12 +77,16 @@ rm %{buildroot}%{gem_instdir}/{README.md,MIT-LICENSE}
 %{gem_instdir}/test
 
 %check
-%if 0%{?fedora} > 16
+%if 0%{?fedora}
+cat %PATCH0 | patch -p1
 sed -i '/require.*bundler/d' test/test_helper.rb
-testrb -Ilib test/*_test.rb
+ruby -Ilib:test -e "Dir.glob './test/*_test.rb', &method(:require)"
 %endif
 
 %changelog
+* Mon Jul 07 2014 Josef Stribny <jstribny at redhat.com> - 0.0.22-6
+- Fix test suite for minitest 5
+
 * Sun Jun 08 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.0.22-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list