Compare commits
11 Commits
224d0f0a4d
...
dd3b985cb0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd3b985cb0 | ||
|
|
ab6bfa8469 | ||
|
|
2ae1ea6a1e | ||
|
|
433c70ef3c | ||
|
|
a41025ed95 | ||
|
|
8bc64ca5ea | ||
|
|
9b32b1085f | ||
|
|
b52a7030ee | ||
|
|
6d32999592 | ||
|
|
2b40e75a83 | ||
|
|
579bfffbc1 |
@ -1,81 +0,0 @@
|
|||||||
From e05fcfffb7ccafcae89674460b2b46dd87b62b7b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Josef Stribny <jstribny@redhat.com>
|
|
||||||
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
|
|
||||||
@ -1,15 +1,18 @@
|
|||||||
%global gem_name test_declarative
|
%global gem_name test_declarative
|
||||||
Summary: Simply adds a declarative test method syntax to test/unit
|
Summary: Simply adds a declarative test method syntax to test/unit
|
||||||
Name: rubygem-%{gem_name}
|
Name: rubygem-%{gem_name}
|
||||||
Version: 0.0.5
|
Version: 0.0.6
|
||||||
Release: 3
|
Release: 2
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: http://github.com/svenfuchs/test_declarative
|
URL: http://github.com/svenfuchs/test_declarative
|
||||||
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
|
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||||
# Minitest 5 support
|
# wget https://github.com/svenfuchs/test_declarative/archive/refs/tags/test_declarative-0.0.6.tar.gz
|
||||||
# https://github.com/svenfuchs/test_declarative/pull/4
|
# tar -xvf test_declarative-0.0.6.tar.gz
|
||||||
Patch0: rubygem-test_declarative-0.0.5-minitest5.patch
|
# cd test_declarative-0.0.6
|
||||||
|
# tar -cvf test_declarative_test-0.0.6.tar.gz test
|
||||||
|
Source1: test_declarative_test-0.0.6.tar.gz
|
||||||
BuildRequires: ruby(release) rubygems-devel rubygem(minitest)
|
BuildRequires: ruby(release) rubygems-devel rubygem(minitest)
|
||||||
|
BuildRequires: rubygem(did_you_mean)
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%description
|
%description
|
||||||
Simply adds a declarative test method syntax to test/unit.
|
Simply adds a declarative test method syntax to test/unit.
|
||||||
@ -23,13 +26,11 @@ BuildArch: noarch
|
|||||||
Documentation for %{name}
|
Documentation for %{name}
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -c -T
|
%setup -q -n %{gem_name}-%{version} -b 1
|
||||||
%gem_install -n %{SOURCE0}
|
|
||||||
pushd .%{gem_instdir}
|
|
||||||
%patch0 -p1
|
|
||||||
popd
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
gem build ../%{gem_name}-%{version}.gemspec
|
||||||
|
%gem_install
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p %{buildroot}%{gem_dir}
|
mkdir -p %{buildroot}%{gem_dir}
|
||||||
@ -38,6 +39,8 @@ cp -a .%{gem_dir}/* \
|
|||||||
|
|
||||||
%check
|
%check
|
||||||
pushd .%{gem_instdir}
|
pushd .%{gem_instdir}
|
||||||
|
ln -s %{_builddir}/test test
|
||||||
|
cd test
|
||||||
ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)'
|
ruby -e 'Dir.glob "./test/**/test_*.rb", &method(:require)'
|
||||||
popd
|
popd
|
||||||
|
|
||||||
@ -50,13 +53,18 @@ popd
|
|||||||
|
|
||||||
%files doc
|
%files doc
|
||||||
%doc %{gem_docdir}
|
%doc %{gem_docdir}
|
||||||
%doc %{gem_instdir}/README.textile
|
%doc %{gem_instdir}/README.md
|
||||||
%{gem_instdir}/test
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jan 09 2024 xu_ping <707078654@qq.com> - 0.0.6-2
|
||||||
|
- fix build error
|
||||||
|
|
||||||
|
* Wed Nov 15 2023 Ge Wang <wang__ge@126.com> - 0.0.6-1
|
||||||
|
- update to version 0.0.6
|
||||||
|
|
||||||
|
* Thu Aug 27 2020 tuShenmei <tushenmei@huawei.com> - 0.0.5-2
|
||||||
|
- modify yaml
|
||||||
|
|
||||||
* Tue Aug 18 2020 tuShenmei <tushenmei@huawei.com> - 0.0.5-1
|
* Tue Aug 18 2020 tuShenmei <tushenmei@huawei.com> - 0.0.5-1
|
||||||
- package init
|
- package init
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Tue Aug 27 2020 tuShenmei <tushenmei@huawei.com> - 0.0.5-3
|
|
||||||
- modify yaml
|
|
||||||
|
|||||||
Binary file not shown.
BIN
test_declarative-0.0.6.gem
Normal file
BIN
test_declarative-0.0.6.gem
Normal file
Binary file not shown.
BIN
test_declarative_test-0.0.6.tar.gz
Normal file
BIN
test_declarative_test-0.0.6.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user