diff --git a/.gitignore b/.gitignore index 81dbc19..f148e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /test_declarative-0.0.5.gem +/test_declarative-0.0.6-test.tar.gz +/test_declarative-0.0.6.gem diff --git a/rubygem-test_declarative-0.0.5-minitest5.patch b/rubygem-test_declarative-0.0.5-minitest5.patch deleted file mode 100644 index cf1851b..0000000 --- a/rubygem-test_declarative-0.0.5-minitest5.patch +++ /dev/null @@ -1,81 +0,0 @@ -From e05fcfffb7ccafcae89674460b2b46dd87b62b7b Mon Sep 17 00:00:00 2001 -From: Josef Stribny -Date: Mon, 19 Jan 2015 18:28:42 +0100 -Subject: [PATCH] Add support for Minitest >=5 - -- add Minitest 5 support -- change tests to work with both test/unit (if available) and Minitest 5 -- fix the test suite on Ruby 1.8.7 by explicitely requiring test/unit/testresult ---- - lib/test_declarative.rb | 1 + - test/test_declarative_test.rb | 37 ++++++++++++++++++++++++++++++++----- - test_declarative.gemspec | 1 + - 3 files changed, 34 insertions(+), 5 deletions(-) - -diff --git a/lib/test_declarative.rb b/lib/test_declarative.rb -index 34ae02b..aae5f74 100644 ---- a/lib/test_declarative.rb -+++ b/lib/test_declarative.rb -@@ -1,6 +1,7 @@ - targets = [Module] - targets << Test::Unit::TestCase if defined?(Test::Unit::TestCase) - targets << MiniTest::Unit::TestCase if defined?(MiniTest::Unit::TestCase) -+targets << Minitest::Test if defined?(Minitest::Test) - - targets.each do |target| - target.class_eval do -diff --git a/test/test_declarative_test.rb b/test/test_declarative_test.rb -index abc1278..c18ff6e 100644 ---- a/test/test_declarative_test.rb -+++ b/test/test_declarative_test.rb -@@ -1,17 +1,44 @@ - $: << File.expand_path('../../lib', __FILE__) - --require 'test/unit' -+# Test with test/unit for older Rubies -+begin -+ require 'test/unit' -+ require 'test/unit/testresult' -+ if RUBY_VERSION < '1.9.1' -+ # test/unit -+ TEST_CASE = Test::Unit::TestCase -+ RUNNER = Test::Unit::TestResult -+ MINITEST_5 = false -+ else -+ # Minitest < 5 -+ TEST_CASE = Test::Unit::TestCase -+ RUNNER = MiniTest::Unit -+ MINITEST_5 = false -+ end -+rescue LoadError -+ # Minitest >= 5 -+ require 'minitest/autorun' -+ TEST_CASE = Minitest::Test -+ RUNNER = Minitest::Unit -+ MINITEST_5 = true -+end -+ - require 'test_declarative' - --class TestDeclarativeTest < Test::Unit::TestCase -+class TestDeclarativeTest < TEST_CASE - def test_responds_to_test - assert self.class.respond_to?(:test) - end - - def test_adds_a_test_method - called = false -- assert_nothing_raised { Test::Unit::TestCase.test('some test') { called = true } } -- Test::Unit::TestCase.new(:'test_some_test').run((RUBY_VERSION < '1.9.1' ? Test::Unit::TestResult : MiniTest::Unit).new) {} -+ TEST_CASE.test('some test') { called = true } -+ case MINITEST_5 -+ when false -+ TEST_CASE.new(:'test_some_test').run(RUNNER.new) {} -+ when true -+ TEST_CASE.new(:'test_some_test').run() {} -+ end - assert called - end --end -\ No newline at end of file -+end diff --git a/rubygem-test_declarative.spec b/rubygem-test_declarative.spec index 0e1cab1..f91b721 100644 --- a/rubygem-test_declarative.spec +++ b/rubygem-test_declarative.spec @@ -1,19 +1,21 @@ # Generated from test_declarative-0.0.5.gem by gem2rpm -*- rpm-spec -*- %global gem_name test_declarative -Summary: Simply adds a declarative test method syntax to test/unit Name: rubygem-%{gem_name} -Version: 0.0.5 -Release: 22%{?dist} +Version: 0.0.6 +Release: 1%{?dist} +Summary: Simply adds a declarative test method syntax to test/unit License: MIT URL: http://github.com/svenfuchs/test_declarative -Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem -# Minitest 5 support -# https://github.com/svenfuchs/test_declarative/pull/4 -Patch0: rubygem-test_declarative-0.0.5-minitest5.patch +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# git clone https://github.com/svenfuchs/test_declarative.git && cd test_declarative +# git archive -v -o test_declarative-0.0.6-test.tar.gz v0.0.6 test/ +Source1: %{gem_name}-%{version}-test.tar.gz BuildRequires: ruby(release) BuildRequires: rubygems-devel +BuildRequires: ruby BuildRequires: rubygem(minitest) +BuildRequires: rubygem(test-unit) BuildArch: noarch %description @@ -26,18 +28,18 @@ Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc -Documentation for %{name} - +Documentation for %{name}. %prep -%setup -q -c -T -%gem_install -n %{SOURCE0} - -pushd .%{gem_instdir} -%patch0 -p1 -popd +%setup -q -n %{gem_name}-%{version} -b 1 %build +# Create the gem as gem install only works on a gem file +gem build ../%{gem_name}-%{version}.gemspec + +# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir +# by default, so that we can move it into the buildroot in %%install +%gem_install %install mkdir -p %{buildroot}%{gem_dir} @@ -46,23 +48,31 @@ cp -a .%{gem_dir}/* \ %check pushd .%{gem_instdir} -ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' +ln -s %{_builddir}/test test + +# Use `BUNDLE_GEMFILE` env variable to trick the test suite to run against +# various test frameworks (and ignore Minitest 4.x). +# https://github.com/svenfuchs/test_declarative/blob/4c0ccc6f649f33f76772a826e6afd367b143cd66/test/test_declarative_test.rb#L10-L37 +BUNDLE_GEMFILE=Gemfile ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' +BUNDLE_GEMFILE=Gemfile.unit-test ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)' popd %files %dir %{gem_instdir} -%exclude %{gem_cache} +%license %{gem_instdir}/MIT-LICENSE %{gem_libdir} +%exclude %{gem_cache} %{gem_spec} -%doc %{gem_instdir}/MIT-LICENSE %files doc %doc %{gem_docdir} -%doc %{gem_instdir}/README.textile -%{gem_instdir}/test - +%doc %{gem_instdir}/README.md %changelog +* Wed Sep 21 2022 Vít Ondruch - 0.0.6-1 +- Update to TestDeclarative 0.0.6. + Resolves: rhbz#1454751 + * Sat Jul 23 2022 Fedora Release Engineering - 0.0.5-22 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 6f9c1ea..f4518e9 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -994da4bb1425c8cb72c7effeeacd5abc test_declarative-0.0.5.gem +SHA512 (test_declarative-0.0.6-test.tar.gz) = a9d9483bccc68bc394844a4bcf39b424533f923adeb58c6aad87c2f16963dd5941f8f356b7caa85e2d751cafee06b4c869f3eaa860a065143bca3487afa70a1c +SHA512 (test_declarative-0.0.6.gem) = 715fd3b4adf121c7bc1c5cc291e388dbf4fb3da64a05d476a333c9308724ef02c1eb213c69808a6e9ce76615d7cf7d34edbc8bcd1525b0718a1d4ee71c5f123a