rubygem-minitest4/rubygem-minitest4.spec

104 lines
2.9 KiB
RPMSpec
Raw Normal View History

2020-07-31 15:49:10 +08:00
%global gem_name minitest
# Use full EVR for provides
%global __provides_exclude_from %{gem_spec}
Summary: Small and fast replacement for ruby's huge and slow test/unit
Name: rubygem-%{gem_name}4
# With 4.7.5, some test fails, so for now use 4.7.0
Version: 4.7.0
2023-01-17 15:17:36 +08:00
Release: 2
2020-07-31 15:49:10 +08:00
License: MIT
URL: https://github.com/seattlerb/minitest
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: rubygems-devel ruby(release)
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}-%{release}
# Also provide this
Provides: rubygem(%{gem_name}4) = %{version}-%{release}
Conflicts: rubygem-minitest < 4.7.0-3
%description
minitest/unit is a small and fast replacement for ruby's huge and slow
test/unit. This is meant to be clean and easy to use both as a regular
test writer and for language implementors that need a minimal set of
methods to bootstrap a working unit test suite.
miniunit/spec is a functionally complete spec engine.
miniunit/mock, by Steven Baker, is a beautifully tiny mock object framework.
This is a compatibitity package for minitest version 4.x.y.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
%description doc
This package contains documentation for %{name}.
%prep
gem unpack %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
2023-01-17 15:17:36 +08:00
sed -i test/minitest/test_minitest_mock.rb \
-e 's|assert_equal expected, e.message|assert_equal expected, e.message.lines(chomp: true)[0]|'
# Ruby 3.2 removes already deprecated Fixnum
sed -i test/minitest/test_minitest_mock.rb \
-e 's|Fixnum|Integer|'
# Ruby 3.2 removes Object#=~
sed -i test/minitest/test_minitest_unit.rb -e 's|\(test_refute_match_matcher_object\)|\1; skip|'
2020-07-31 15:49:10 +08:00
%build
gem build %{gem_name}.gemspec
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -pa .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
find %{buildroot}%{gem_instdir}/lib -type f | \
xargs -n 1 sed -i -e '/^#!\/usr\/bin\/ruby.*/d'
# Ships with extremely tight permissions, bring them inline with other gems
find %{buildroot}%{gem_instdir} -type f | \
xargs chmod 0644
# Cleanup
rm -f %{buildroot}%{gem_instdir}/{.autotest,.gemtest}
rm -f %{buildroot}%{gem_cache}
rm -rf %{buildroot}%{gem_instdir}/{Rakefile,test/}
%check
pushd .%{gem_instdir}
# spec test suite is unstable.
# https://github.com/seattlerb/minitest/issues/257
mv test/minitest/test_minitest_spec.rb{,.ignore}
for f in test/minitest/test_*.rb
do
ruby -Ilib:.:./test $f
done
%files
%doc %{gem_instdir}/History.txt
%doc %{gem_instdir}/Manifest.txt
%license %{gem_instdir}/README.txt
%dir %{gem_instdir}
%{gem_libdir}/
%{gem_spec}
%files doc
%{gem_instdir}/design_rationale.rb
%doc %{gem_docdir}/
%changelog
2023-01-17 15:17:36 +08:00
* Tue Jan 17 2023 caodongxia <caodongxia@h-partners.com> - 4.7.0-2
- Adapts to Ruby 3.1.3
2020-07-31 15:49:10 +08:00
* Mon Jul 27 2020 wangxiao <wangxiao65@huawei.com> - 4.7.0-1
- package init