Blob Blame History Raw
# Generated from shoulda-matchers-2.6.1.gem by gem2rpm -*- rpm-spec -*-
%global gem_name shoulda-matchers

Name: rubygem-%{gem_name}
Version: 3.1.2
Release: 2%{?dist}
Summary: Making tests easy on the fingers and eyes
License: MIT
URL: https://github.com/thoughtbot/shoulda-matchers
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Fix "undefined method `capture' for module `Kernel'" error.
# https://github.com/thoughtbot/shoulda-matchers/commit/26522c6b788d96c20027d794178c83f4b6a630b7
Patch0: rubygem-shoulda-matchers-3.1.2-capture-silence_stream-and-silence_stderr-were-removed-in-Rails-5.patch
# Fix "undefined method `attr_accessible'" error.
# https://github.com/thoughtbot/shoulda-matchers/commit/c50af24105399651b1bdbf52bddbb9c72d2b2e19
Patch1: rubygem-shoulda-matchers-3.1.2-Don-t-protect-attributes-under-Rails-5.patch
# https://github.com/thoughtbot/shoulda-matchers/commit/45ac5f5d754dae58708f4baef550e4986132d1ec
Patch2: rubygem-shoulda-matchers-3.1.2-Fix-uniqueness-tests-to-not-use-attr_accessible.patch
# Fix deprecated Fixnum.
# https://github.com/thoughtbot/shoulda-matchers/commit/03a1d213805a44a0aec99857e01cab8524aa0c05
Patch3: rubygem-shoulda-matchers-3.1.2-Deprecation-for-ruby24-removed.patch
# Fix "undefined method `cast_type'" error.
# https://github.com/formigarafa/shoulda-matchers/pull/2/commits/df04f8704abc3754c63c488433dac8c30573da6b
Patch5: rubygem-shoulda-matchers-3.1.2-Fix-Serialize-Matcher-error-undefined-method-cast_type.patch
# Refactoring of RailsShim used by other patches. It would be hard to backrpot
# the patches without this one.
# https://github.com/formigarafa/shoulda-matchers/pull/2/commits/84069646544ce701e6864458378323e1e3361140
Patch6: rubygem-shoulda-matchers-3.1.2-Refactor-RailsShim.patch
# Scope request parameters according to Rails version.
# https://github.com/thoughtbot/shoulda-matchers/commit/ce9624b3c5a08b9134150e228440c771d95782b7
Patch7: rubygem-shoulda-matchers-3.1.2-Scope-request-parameters-according-to-Rails-version.patch
# Fix "undefined method `attr_accessible'" errors.
# https://github.com/thoughtbot/shoulda-matchers/commit/c1a81d4b132a9e6091c42c3ebcd3144fc593c016
Patch8: rubygem-shoulda-matchers-3.1.2-Disable-allow_mass_assignment_of-tests-under-Rails-5.patch
# Fix "undefined method `*_filter' for HookController:Class" errors.
# https://github.com/thoughtbot/shoulda-matchers/commit/6ea9afc1066502fdd5c556fa9edd4ce7085169fc
Patch9: rubygem-shoulda-matchers-3.1.2-Drop-legacy-callback-matchers-under-Rails-5.patch
# `render nothing: true` was removed from Rails 5.1 and has no effect anymore.
# https://github.com/thoughtbot/shoulda-matchers/commit/158839b3a60f0c2a1f243f6e65ec620be55982ee
Patch10: rubygem-shoulda-matchers-3.1.2-Use-head-instead-of-render-nothing-in-tests.patch
# Fix "wrong number of arguments (given 1, expected 2)" error.
# https://github.com/thoughtbot/shoulda-matchers/commit/3dbf2e5646d6b769c6392cdb71003d0f4aee2304
Patch11: rubygem-shoulda-matchers-3.1.2-Fix-built-in-test-custom-models-with-attrs.patch
# Fix failing association matcher tests.
# https://github.com/thoughtbot/shoulda-matchers/commit/5e1e531b8b3fd35a526e73465bd4de64c22a1763
Patch12: rubygem-shoulda-matchers-3.1.2-Fix-failing-association-matcher-tests.patch
# Fix validate_inclusion_of tests.
# https://github.com/thoughtbot/shoulda-matchers/commit/76e63b2638e1fcc84819bdca49d768a635346f5d
Patch13: rubygem-shoulda-matchers-3.1.2-Fix-validate_inclusion_of-tests.patch
# Fix migrations in Rails 5.2.
# https://github.com/thoughtbot/shoulda-matchers/commit/b310986f9a3b7547c98e54db97600f8128e28ff5
Patch14: rubygem-shoulda-matchers-3.1.2-Use-correct-migration-class-in-acceptance-tests.patch
# Fix `forwarding to private method` warning.
# https://github.com/thoughtbot/shoulda-matchers/pull/1038
Patch15: rubygem-shoulda-matchers-3.1.2-Define-respond_to_missing-on-ObjectDouble.patch
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby
BuildRequires: rubygem(activeresource)
BuildRequires: rubygem(bcrypt)
BuildRequires: rubygem(jbuilder)
BuildRequires: rubygem(minitest-reporters)
BuildRequires: rubygem(rails)
BuildRequires: rubygem(rails-controller-testing)
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rspec-rails)
BuildRequires: rubygem(shoulda-context)
BuildRequires: rubygem(spring)
BuildRequires: 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

%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}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/



%check
pushd .%{gem_instdir}

# It is easier to recreate the Gemfile to use local versions of gems.
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

# Pry is useless for our purposes.
sed -i "/require 'pry/ s/^/#/" spec/spec_helper.rb

# Avoid Appraisal and Bundler.
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

# Avoid bootsnap, listen and puma dependencies.
sed -i '/rails new/ s/)/ --skip-bootsnap --skip-listen --skip-puma)/' spec/support/unit/rails_application.rb

bundle exec rspec spec/unit

# The upream .gemspec is not usable for tests due to depenency on Git.
ln -sf %{_builddir}/%{gem_name}-%{version}.gemspec %{gem_name}.gemspec

# Avoid bootsnap, listen, puma and sprockets dependencies.
sed -i '/rails new/ s/"$/ --skip-bootsnap --skip-listen --skip-puma --skip-sprockets"/' spec/support/acceptance/helpers/step_helpers.rb

# Don't test against PostgreSQL, it would just complicate everything.
sed -i "/bundle.add_gem 'pg'/ s/^/#/" spec/support/acceptance/helpers/step_helpers.rb
# spring-commands-rspec is not in Fedora yet, but the test suite looks to pass
# without it just fine.
sed -i "/add_gem 'spring-commands-rspec'/ s/^/#/" spec/support/acceptance/helpers/step_helpers.rb
# Remove useless test dependencies.
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}/.*
# This would just complicate licensing due to bundled JS/CSS without any
# real benefit.
%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
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Aug 11 2018 Vít Ondruch <vondruch@redhat.com> - 3.1.2-1
- Update to should-matchers 3.1.2.

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Fri Jun 26 2015 Vít Ondruch <vondruch@redhat.com> - 2.8.0-1
- Update to should-matchers 2.8.0.

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.6.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Jul 07 2014 Vít Ondruch <vondruch@redhat.com> - 2.6.1-3
- Workaround RoR 4.1.2+ compatibility issue.
- Relax Rake dependency.

* Thu Jul 03 2014 Vít Ondruch <vondruch@redhat.com> - 2.6.1-2
- Add missing BR: rubygem(shoulda-context).
- Updated upstream URL.
- Relaxed BR: ruby dependency.

* Mon Jun 30 2014 Vít Ondruch <vondruch@redhat.com> - 2.6.1-1
- Initial package