rubygem-shoulda-matchers/rubygem-shoulda-matchers.spec
2022-06-29 19:01:30 +08:00

124 lines
4.2 KiB
RPMSpec

%global gem_name shoulda-matchers
Name: rubygem-%{gem_name}
Version: 4.5.1
Release: 1
Summary: Making tests easy on the fingers and eyes
License: MIT
URL: https://github.com/thoughtbot/shoulda-matchers
Source0: https://rubygems.org/gems/shoulda-matchers-%{version}.gem
# git clone https://github.com/thoughtbot/shoulda-matchers.git && cd shoulda-matchers
# git archive -v -o shoulda-matchers-4.5.1-specs.tar.gz v4.5.1 spec/
Source1: shoulda-matchers-4.5.1-specs.tar.gz
# Fix bootsnap removal which is not enclosed in quotes.
# https://github.com/thoughtbot/shoulda-matchers/pull/1410
Patch0: rubygem-shoulda-matchers-4.5.1-Remove-rack-mini-profiler-dependency.patch
Patch1: rubygem-shoulda-matchers-4.1.2-Accept-double-quotes-when-removing-bootsnap.patch
Patch2: rubygem-shoulda-matchers-4.5.1-Fix-keyword-arguments-for-Ruby-3.0-compatibility.patch
Patch3: rubygem-shoulda-matchers-4.5.1-Disable-test-failing-due-to-changes-in-Rails-6.1.patch
Patch4: rubygem-shoulda-matchers-4.5.1-Disable-CPK-test-cases-due-to-Rails-6.1-compatibilit.patch
# Fix kwargs for Ruby 3.
# https://github.com/thoughtbot/shoulda-matchers/pull/1406
Patch5: rubygem-shoulda-matchers-4.5.1-Handle-argument-delegation-for-Ruby-3.patch
BuildRequires: ruby(release) rubygems-devel ruby rubygem(activeresource) rubygem(bcrypt)
BuildRequires: rubygem(jbuilder) rubygem(minitest-reporters) rubygem(rails)
BuildRequires: rubygem(rails-controller-testing) rubygem(rspec) rubygem(rspec-rails)
BuildRequires: rubygem(shoulda-context) rubygem(spring) rubygem(sqlite3)
BuildArch: noarch
%description
shoulda-matchers provides Test::Unit- and RSpec-compatible one-liners that
test common Rails functionality. These tests would otherwise be much longer,
more complex, and error-prone.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version} -b 1
%patch5 -p1
pushd %{_builddir}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
popd
%build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
ln -s %{_builddir}/spec spec
cat << GF > Gemfile
source 'https://rubygems.org'
gem 'actiontext'
gem 'bcrypt'
gem 'rails'
gem 'rails-controller-testing'
gem 'rspec'
gem 'rspec-rails'
gem 'sqlite3'
gem 'spring'
GF
sed -i "/require 'pry/ s/^/#/" spec/spec_helper.rb
sed -i "/current_bundle/ s/^/#/" \
spec/acceptance_spec_helper.rb \
spec/support/unit/load_environment.rb
sed -i "/CurrentBundle/ s/^/#/" \
spec/acceptance_spec_helper.rb \
spec/support/unit/load_environment.rb
sed -i "/def rails_new_command/,/^ end$/ {
/\]/i\ '--skip-listen',
}" spec/support/unit/rails_application.rb
sed -i '/rails new/ s/"$/ --skip-bootsnap --skip-listen --skip-puma --skip-sprockets"/' \
spec/support/acceptance/helpers/step_helpers.rb
bundle exec rspec spec/unit
sed -i "/bundle.add_gem 'pg'/ s/^/#/" spec/support/acceptance/helpers/step_helpers.rb
sed -i "/add_gem 'spring-commands-rspec'/ s/^/#/" spec/support/acceptance/helpers/step_helpers.rb
sed -i "/updating_bundle do |bundle|/a \\
bundle.remove_gem 'capybara'" spec/support/acceptance/helpers/step_helpers.rb
sed -i "/updating_bundle do |bundle|/a \\
bundle.remove_gem 'selenium-webdriver'" spec/support/acceptance/helpers/step_helpers.rb
sed -i "/updating_bundle do |bundle|/a \\
bundle.remove_gem 'webdrivers'" spec/support/acceptance/helpers/step_helpers.rb
DISABLE_SPRING=true bundle exec rspec spec/acceptance
popd
%files
%dir %{gem_instdir}
%license %{gem_instdir}/LICENSE
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%doc %{gem_instdir}/docs
%{gem_instdir}/shoulda-matchers.gemspec
%changelog
* Wed Jun 29 2022 liyanan <liyanan32@h-partners.com> - 4.5.1-1
- Upgrade to version 4.5.1
* Thu Mar 3 2022 liyanan <liyanan32@huawei.com> - 3.1.2-2
- fix build error
* Mon Aug 10 2020 yanan li <liyanan032@huawei.com> - 3.1.2-1
- Package init