%global gem_name shoulda-matchers Name: rubygem-%{gem_name} Version: 3.1.2 Release: 2 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 Patch0: rubygem-shoulda-matchers-3.1.2-capture-silence_stream-and-silence_stderr-were-removed-in-Rails-5.patch Patch1: rubygem-shoulda-matchers-3.1.2-Don-t-protect-attributes-under-Rails-5.patch Patch2: rubygem-shoulda-matchers-3.1.2-Fix-uniqueness-tests-to-not-use-attr_accessible.patch Patch3: rubygem-shoulda-matchers-3.1.2-Deprecation-for-ruby24-removed.patch Patch5: rubygem-shoulda-matchers-3.1.2-Fix-Serialize-Matcher-error-undefined-method-cast_type.patch Patch6: rubygem-shoulda-matchers-3.1.2-Refactor-RailsShim.patch Patch7: rubygem-shoulda-matchers-3.1.2-Scope-request-parameters-according-to-Rails-version.patch Patch8: rubygem-shoulda-matchers-3.1.2-Disable-allow_mass_assignment_of-tests-under-Rails-5.patch Patch9: rubygem-shoulda-matchers-3.1.2-Drop-legacy-callback-matchers-under-Rails-5.patch Patch10: rubygem-shoulda-matchers-3.1.2-Use-head-instead-of-render-nothing-in-tests.patch Patch11: rubygem-shoulda-matchers-3.1.2-Fix-built-in-test-custom-models-with-attrs.patch Patch12: rubygem-shoulda-matchers-3.1.2-Fix-failing-association-matcher-tests.patch Patch13: rubygem-shoulda-matchers-3.1.2-Fix-validate_inclusion_of-tests.patch Patch14: rubygem-shoulda-matchers-3.1.2-Use-correct-migration-class-in-acceptance-tests.patch Patch15: rubygem-shoulda-matchers-3.1.2-Define-respond_to_missing-on-ObjectDouble.patch #https://github.com/thoughtbot/shoulda-matchers/commit/0c07bfb039b0fe9f9863e885ee3885e48f3b39d9 Patch16: fix-bigdecimal-deprecated.patch #https://github.com/thoughtbot/shoulda-matchers/pull/1427/commits/740930ee28dab97d14542d1ea7ad60e22b602ab3 Patch17: Fix-warning-Using-the-last-argument-as-keyword-parameters-is-deprecated.patch #https://github.com/thoughtbot/shoulda-matchers/pull/1406/commits/937256be204487727727cecc18519d85b91201d5 Patch18: Handle-argument-delegation-for-ruby-3.patch #https://github.com/thoughtbot/shoulda-matchers/pull/1406/commits/937256be204487727727cecc18519d85b91201d5 Patch19: fix-ruby-2.7-warning.patch #https://github.com/thoughtbot/shoulda-matchers/commit/ae9bf4a7355038e7e6ea13429abf815c6579f600 Patch20: Add-minimal-support-For-rails-6.patch #https://github.com/thoughtbot/shoulda-matchers/commit/d39685139f878ae7295320b4707a80f16a42d427 Patch21: fix-build-error.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} %patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch5 -p1 %patch6 -p1 %patch7 -p1 %gemspec_add_file "spec/support/unit/helpers/action_pack_versions.rb" %patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 %gemspec_add_file "spec/support/acceptance/helpers/rails_migration_helpers.rb" %patch15 -p1 %patch16 -p1 %patch17 -p1 %patch18 -p1 %patch19 -p1 %patch20 -p1 %patch21 -p1 %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} rm Gemfile.lock cat << GF > Gemfile source 'https://rubygems.org' gem 'activeresource' gem 'bcrypt' gem 'rails' gem 'rails-controller-testing' gem 'rspec' gem 'rspec-rails' gem 'sqlite3' gem 'spring' GF mv spec/unit/shoulda/matchers/{active_record/association_matcher_spec.rb,active_model/helpers_spec.rb} ./ mv spec/acceptance/{rails_integration_spec.rb,multiple_libraries_integration_spec.rb} ./ sed -i "/require 'pry/ s/^/#/" spec/spec_helper.rb sed -i "/current_bundle/ s/^/#/" spec/acceptance_spec_helper.rb sed -i "/assert_appraisal/ s/^/#/" spec/acceptance_spec_helper.rb sed -i "/current_bundle/ s/^/#/" spec/support/unit/load_environment.rb sed -i "/assert_appraisal/ s/^/#/" spec/support/unit/load_environment.rb sed -i '/rails new/ s/)/ --skip-bootsnap --skip-listen --skip-puma)/' spec/support/unit/rails_application.rb bundle exec rspec spec/unit ln -sf %{_builddir}/%{gem_name}-%{version}.gemspec %{gem_name}.gemspec sed -i '/rails new/ s/"$/ --skip-bootsnap --skip-listen --skip-puma --skip-sprockets"/' spec/support/acceptance/helpers/step_helpers.rb 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 'chromedriver-helper'" spec/support/acceptance/helpers/step_helpers.rb bundle exec rspec spec/acceptance popd %files %dir %{gem_instdir} %exclude %{gem_instdir}/.* %exclude %{gem_instdir}/doc_config %license %{gem_instdir}/MIT-LICENSE %{gem_libdir} %exclude %{gem_cache} %{gem_spec} %files doc %doc %{gem_docdir} %{gem_instdir}/Appraisals %doc %{gem_instdir}/CONTRIBUTING.md %{gem_instdir}/Gemfile* %{gem_instdir}/NEWS.md %doc %{gem_instdir}/README.md %{gem_instdir}/Rakefile %{gem_instdir}/custom_plan.rb %doc %{gem_instdir}/docs %{gem_instdir}/gemfiles %{gem_instdir}/script %{gem_instdir}/shoulda-matchers.gemspec %{gem_instdir}/spec %{gem_instdir}/tasks %{gem_instdir}/zeus.json %changelog * Thu Mar 3 2022 liyanan - 3.1.2-2 - fix build error * Mon Aug 10 2020 yanan li - 3.1.2-1 - Package init