Fix for Ruby 2.4.0 compatibility.
This commit is contained in:
parent
42b63df6cf
commit
9b467561e2
@ -0,0 +1,73 @@
|
||||
diff --git a/spec/rspec/support/fuzzy_matcher_spec.rb b/spec/rspec/support/fuzzy_matcher_spec.rb
|
||||
index fc92ec5..2c0abec 100644
|
||||
--- a/spec/rspec/support/fuzzy_matcher_spec.rb
|
||||
+++ b/spec/rspec/support/fuzzy_matcher_spec.rb
|
||||
@@ -120,17 +120,17 @@ module RSpec
|
||||
end
|
||||
|
||||
it 'does the fuzzy matching on the individual elements' do
|
||||
- expect([String, Fixnum]).to match_against(["a", 2])
|
||||
- expect([String, Fixnum]).not_to match_against([2, "a"])
|
||||
+ expect([String, Integer]).to match_against(["a", 2])
|
||||
+ expect([String, Integer]).not_to match_against([2, "a"])
|
||||
end
|
||||
|
||||
it 'returns false if they have a different number of elements' do
|
||||
- expect([String, Fixnum]).not_to match_against(['a', 2, nil])
|
||||
+ expect([String, Integer]).not_to match_against(['a', 2, nil])
|
||||
end
|
||||
|
||||
it 'supports arbitrary nested arrays' do
|
||||
a1 = [
|
||||
- [String, Fixnum, [be_within(0.1).of(2)]],
|
||||
+ [String, Integer, [be_within(0.1).of(2)]],
|
||||
3, [[[ /foo/ ]]]
|
||||
]
|
||||
|
||||
@@ -154,8 +154,8 @@ module RSpec
|
||||
end
|
||||
end.new
|
||||
|
||||
- expect([Fixnum, String]).to match_against(my_enum)
|
||||
- expect([String, Fixnum]).not_to match_against(my_enum)
|
||||
+ expect([Integer, String]).to match_against(my_enum)
|
||||
+ expect([String, Integer]).not_to match_against(my_enum)
|
||||
end
|
||||
|
||||
it 'does not match an empty hash against an empty array or vice-versa' do
|
||||
@@ -192,7 +192,7 @@ module RSpec
|
||||
it 'supports arbitrary nested hashes' do
|
||||
h1 = {
|
||||
:a => {
|
||||
- :b => [String, Fixnum],
|
||||
+ :b => [String, Integer],
|
||||
:c => { :d => be_within(0.1).of(2) }
|
||||
}
|
||||
}
|
||||
diff --git a/spec/rspec/support/object_formatter_spec.rb b/spec/rspec/support/object_formatter_spec.rb
|
||||
index 7e16fb5..6eed58c 100644
|
||||
--- a/spec/rspec/support/object_formatter_spec.rb
|
||||
+++ b/spec/rspec/support/object_formatter_spec.rb
|
||||
@@ -82,10 +82,19 @@ module RSpec
|
||||
|
||||
let(:formatted_decimal) { ObjectFormatter.format(decimal) }
|
||||
|
||||
- it 'fails with a conventional representation of the decimal' do
|
||||
- in_sub_process_if_possible do
|
||||
- require 'bigdecimal'
|
||||
- expect(formatted_decimal).to include('3.3 (#<BigDecimal')
|
||||
+ if RUBY_VERSION >= '2.4'
|
||||
+ it "uses Ruby's BigDecimal formatting since it is improved in 2.4+" do
|
||||
+ in_sub_process_if_possible do
|
||||
+ require 'bigdecimal'
|
||||
+ expect(formatted_decimal).to eq('0.33e1')
|
||||
+ end
|
||||
+ end
|
||||
+ else
|
||||
+ it 'includes a conventional representation of the decimal' do
|
||||
+ in_sub_process_if_possible do
|
||||
+ require 'bigdecimal'
|
||||
+ expect(formatted_decimal).to include('3.3 (#<BigDecimal')
|
||||
+ end
|
||||
end
|
||||
end
|
18
rubygem-rspec-support-3.6.0.beta2-fix-for-ruby-2.4.0.patch
Normal file
18
rubygem-rspec-support-3.6.0.beta2-fix-for-ruby-2.4.0.patch
Normal file
@ -0,0 +1,18 @@
|
||||
diff --git a/lib/rspec/support/object_formatter.rb b/lib/rspec/support/object_formatter.rb
|
||||
index 6f74061..6c83209 100644
|
||||
--- a/lib/rspec/support/object_formatter.rb
|
||||
+++ b/lib/rspec/support/object_formatter.rb
|
||||
@@ -243,7 +243,12 @@ module RSpec
|
||||
DescribableMatcherInspector,
|
||||
DelegatorInspector,
|
||||
InspectableObjectInspector
|
||||
- ]
|
||||
+ ].tap do |classes|
|
||||
+ # 2.4 has improved BigDecimal formatting so we do not need
|
||||
+ # to provide our own.
|
||||
+ # https://github.com/ruby/bigdecimal/pull/42
|
||||
+ classes.delete(BigDecimalInspector) if RUBY_VERSION >= '2.4'
|
||||
+ end
|
||||
end
|
||||
end
|
||||
end
|
@ -3,7 +3,7 @@
|
||||
%global mainver 3.5.0
|
||||
%undefine prever
|
||||
|
||||
%global mainrel 1
|
||||
%global mainrel 2
|
||||
%global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g')
|
||||
|
||||
%global need_bootstrap_set 0
|
||||
@ -22,6 +22,10 @@ Source1: rubygem-%{gem_name}-%{version}-full.tar.gz
|
||||
Source2: rspec-related-create-full-tarball.sh
|
||||
# tweak regex for search path
|
||||
Patch0: rubygem-rspec-support-3.2.1-callerfilter-searchpath-regex.patch
|
||||
# Fix for Ruby 2.4.0 compatiblity.
|
||||
# https://github.com/rspec/rspec-support/commit/725fc24
|
||||
Patch1: rubygem-rspec-support-3.6.0.beta2-fix-for-ruby-2.4.0.patch
|
||||
Patch2: rubygem-rspec-support-3.6.0.beta2-fix-for-ruby-2.4.0-tests.patch
|
||||
|
||||
#BuildRequires: ruby(release)
|
||||
BuildRequires: rubygems-devel
|
||||
@ -33,8 +37,6 @@ BuildRequires: git
|
||||
%endif
|
||||
|
||||
BuildArch: noarch
|
||||
# Need fix
|
||||
Provides: rubygem(%{gem_name}) = %{version}-%{release}
|
||||
|
||||
%description
|
||||
`RSpec::Support` provides common functionality to `RSpec::Core`,
|
||||
@ -61,6 +63,7 @@ gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
||||
(
|
||||
cd %{gem_name}-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
)
|
||||
|
||||
%build
|
||||
@ -77,6 +80,8 @@ cp -pa .%{gem_dir}/* \
|
||||
LANG=en_US.UTF-8
|
||||
pushd %{gem_name}-%{version}
|
||||
|
||||
cat %{PATCH2} | patch -p1
|
||||
|
||||
# Test failure needs investigation...
|
||||
FAILFILE=()
|
||||
FAILTEST=()
|
||||
@ -111,6 +116,9 @@ popd
|
||||
%doc %{gem_docdir}
|
||||
|
||||
%changelog
|
||||
* Fri Feb 03 2017 Jun Aruga <jaruga@redhat.com> - 3.5.0-2
|
||||
- Fix for Ruby 2.4.0 compatibility.
|
||||
|
||||
* Sun Jul 24 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.0-1
|
||||
- Enable tests again
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user