Backport patch to fix test failure with ruby 2.5
This commit is contained in:
parent
9efec799ef
commit
e5273eee8a
66
rspec-mocks-3.7.0-test-ruby-25.patch
Normal file
66
rspec-mocks-3.7.0-test-ruby-25.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 871eb31e3bfe50705ca57e754771aa1e0164f12d Mon Sep 17 00:00:00 2001
|
||||
From: Myron Marston <myron.marston@gmail.com>
|
||||
Date: Sat, 30 Dec 2017 17:45:43 -0800
|
||||
Subject: [PATCH 1/2] Skip spec that does not apply to Ruby 2.5.
|
||||
|
||||
Ruby 2.5 has removed the ability to access top-level constants
|
||||
via a confusing nested form (e.g. `MyClass::Hash`), so we no
|
||||
longer need this spec there.
|
||||
|
||||
For #1192.
|
||||
---
|
||||
spec/rspec/mocks/mutate_const_spec.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/spec/rspec/mocks/mutate_const_spec.rb b/spec/rspec/mocks/mutate_const_spec.rb
|
||||
index fe8d4128..9d80dd73 100644
|
||||
--- a/spec/rspec/mocks/mutate_const_spec.rb
|
||||
+++ b/spec/rspec/mocks/mutate_const_spec.rb
|
||||
@@ -170,7 +170,7 @@ def change_const_value_to(value)
|
||||
expect(::Hash).to equal(top_level_hash)
|
||||
end
|
||||
|
||||
- it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings do
|
||||
+ it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings, :if => RUBY_VERSION < '2.5' do
|
||||
top_level_hash = ::Hash
|
||||
|
||||
hide_const("TestClass::Hash")
|
||||
|
||||
From 783923d6879a2f9df9fee8ef24cecca6ac21136e Mon Sep 17 00:00:00 2001
|
||||
From: Myron Marston <myron.marston@gmail.com>
|
||||
Date: Sat, 30 Dec 2017 23:35:27 -0800
|
||||
Subject: [PATCH 2/2] Make spec less brittle.
|
||||
|
||||
On Ruby 2.5, this spec failed, apparently due to the fact that
|
||||
Method equality has changed on 2.5 slightly. The method instances
|
||||
have always been different but 2.4 and before considered them
|
||||
equivalent. Instead, we can show that the two method objects
|
||||
_behave_ the same, which is what we really care about.
|
||||
|
||||
Fixes #1192.
|
||||
---
|
||||
spec/rspec/mocks/and_wrap_original_spec.rb | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/spec/rspec/mocks/and_wrap_original_spec.rb b/spec/rspec/mocks/and_wrap_original_spec.rb
|
||||
index df9cae46..2d4d0a8b 100644
|
||||
--- a/spec/rspec/mocks/and_wrap_original_spec.rb
|
||||
+++ b/spec/rspec/mocks/and_wrap_original_spec.rb
|
||||
@@ -26,12 +26,13 @@ def results
|
||||
}.to raise_error NameError
|
||||
end
|
||||
|
||||
- it "passes in the original method" do
|
||||
- value = nil
|
||||
+ it "passes along the original method" do
|
||||
+ passed_method = nil
|
||||
original_method = instance.method(:results)
|
||||
- allow_it.to receive(:results).and_wrap_original { |m| value = m }
|
||||
+ allow_it.to receive(:results).and_wrap_original { |m| passed_method = m }
|
||||
instance.results
|
||||
- expect(value).to eq original_method
|
||||
+
|
||||
+ expect(passed_method.call).to eq(original_method.call)
|
||||
end
|
||||
|
||||
it "passes along the message arguments" do
|
@ -3,7 +3,7 @@
|
||||
%global rpmminorver .%(echo %preminorver | sed -e 's|^\\.\\.*||')
|
||||
%global fullver %{majorver}%{?preminorver}
|
||||
|
||||
%global fedorarel 2
|
||||
%global fedorarel 3
|
||||
|
||||
%global gem_name rspec-mocks
|
||||
|
||||
@ -23,6 +23,9 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{fullver}.gem
|
||||
# %%{SOURCE2} %%{name} %%{version}
|
||||
Source1: rubygem-%{gem_name}-%{version}-full.tar.gz
|
||||
Source2: rspec-related-create-full-tarball.sh
|
||||
# https://github.com/rspec/rspec-mocks/pull/1196
|
||||
# https://github.com/rspec/rspec-mocks/commit/1d2f2404a17c3a76742379bb0c57d133df8e7371.patch
|
||||
Patch1: rspec-mocks-3.7.0-test-ruby-25.patch
|
||||
|
||||
#BuildRequires: ruby(release)
|
||||
BuildRequires: rubygems-devel
|
||||
@ -50,6 +53,7 @@ This package contains documentation for %{name}.
|
||||
gem unpack %{SOURCE0}
|
||||
|
||||
%setup -q -D -T -n %{gem_name}-%{version} -b 1
|
||||
%patch1 -p1
|
||||
|
||||
gem specification %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
||||
|
||||
@ -88,6 +92,9 @@ ruby -rrubygems -Ilib/ -S rspec spec/
|
||||
%{gem_docdir}
|
||||
|
||||
%changelog
|
||||
* Wed Feb 14 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.7.1-3
|
||||
- Backport patch to fix test failure with ruby 2.5
|
||||
|
||||
* Tue Feb 13 2018 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.7.1-2
|
||||
- ruby 2.5 drops -rubygems usage
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user