!4 [sync] PR-3: 修复uninitialized constant Fixnum and uninitialized method =~报错
From: @openeuler-sync-bot Reviewed-by: @jxy_git Signed-off-by: @jxy_git
This commit is contained in:
commit
5220374a19
185
Fix-uninitialized-constant-and-method-ruby3.2.patch
Normal file
185
Fix-uninitialized-constant-and-method-ruby3.2.patch
Normal file
@ -0,0 +1,185 @@
|
||||
diff -Nur a/spec/rspec/expectations/expectation_target_spec.rb b/spec/rspec/expectations/expectation_target_spec.rb
|
||||
--- a/spec/rspec/expectations/expectation_target_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/expectations/expectation_target_spec.rb 2023-08-15 10:45:59.150248326 +0800
|
||||
@@ -53,14 +53,14 @@
|
||||
it 'fails an invalid negative expectation' do
|
||||
message = /expected 5 not to be a kind of Integer/
|
||||
expect {
|
||||
- expect(5).not_to be_a(Fixnum)
|
||||
+ expect(5).not_to be_an(Integer)
|
||||
}.to fail_with(message)
|
||||
end
|
||||
|
||||
it 'fails an invalid negative expectation with a split infinitive' do
|
||||
message = /expected 5 not to be a kind of Integer/
|
||||
expect {
|
||||
- expect(5).to_not be_a(Fixnum)
|
||||
+ expect(5).to_not be_an(Integer)
|
||||
}.to fail_with(message)
|
||||
end
|
||||
|
||||
diff -Nur a/spec/rspec/matchers/be_instance_of_spec.rb b/spec/rspec/matchers/be_instance_of_spec.rb
|
||||
--- a/spec/rspec/matchers/be_instance_of_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/matchers/be_instance_of_spec.rb 2023-08-15 10:56:58.727809557 +0800
|
||||
@@ -4,12 +4,12 @@
|
||||
module Matchers
|
||||
[:be_an_instance_of, :be_instance_of].each do |method|
|
||||
describe "expect(actual).to #{method}(expected)" do
|
||||
- it_behaves_like "an RSpec matcher", :valid_value => 5, :invalid_value => "a" do
|
||||
- let(:matcher) { send(method, Fixnum) }
|
||||
+ it_behaves_like "an RSpec matcher", :valid_value => "a", :invalid_value => 5 do
|
||||
+ let(:matcher) { send(method, String) }
|
||||
end
|
||||
|
||||
it "passes if actual is instance of expected class" do
|
||||
- expect(5).to send(method, Fixnum)
|
||||
+ expect("a").to send(method, String)
|
||||
end
|
||||
|
||||
it "fails if actual is instance of subclass of expected class" do
|
||||
diff -Nur a/spec/rspec/matchers/be_kind_of_spec.rb b/spec/rspec/matchers/be_kind_of_spec.rb
|
||||
--- a/spec/rspec/matchers/be_kind_of_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/matchers/be_kind_of_spec.rb 2023-08-15 11:04:27.634316902 +0800
|
||||
@@ -5,11 +5,11 @@
|
||||
[:be_a_kind_of, :be_kind_of].each do |method|
|
||||
describe "expect(actual).to #{method}(expected)" do
|
||||
it_behaves_like "an RSpec matcher", :valid_value => 5, :invalid_value => "a" do
|
||||
- let(:matcher) { send(method, Fixnum) }
|
||||
+ let(:matcher) { send(method, Integer) }
|
||||
end
|
||||
|
||||
it "passes if actual is instance of expected class" do
|
||||
- expect(5).to send(method, Fixnum)
|
||||
+ expect("string").to send(method, String)
|
||||
end
|
||||
|
||||
it "passes if actual is instance of subclass of expected class" do
|
||||
diff -Nur a/spec/rspec/matchers/be_spec.rb b/spec/rspec/matchers/be_spec.rb
|
||||
--- a/spec/rspec/matchers/be_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/matchers/be_spec.rb 2023-08-15 10:59:58.930421773 +0800
|
||||
@@ -512,7 +512,7 @@
|
||||
|
||||
describe "be_an_instance_of" do
|
||||
it "passes when direct class matches" do
|
||||
- expect(5).to be_an_instance_of(Fixnum)
|
||||
+ expect("string").to be_an_instance_of(String)
|
||||
end
|
||||
|
||||
it "fails when class is higher up hierarchy" do
|
||||
diff -Nur a/spec/rspec/matchers/change_spec.rb b/spec/rspec/matchers/change_spec.rb
|
||||
--- a/spec/rspec/matchers/change_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/matchers/change_spec.rb 2023-08-15 11:02:35.244687703 +0800
|
||||
@@ -32,14 +32,14 @@
|
||||
val = nil
|
||||
|
||||
expect {
|
||||
- val = 42
|
||||
- }.to change { val.class }.from(NilClass).to(Fixnum)
|
||||
+ val = "string"
|
||||
+ }.to change { val.class }.from(NilClass).to(String)
|
||||
|
||||
expect {
|
||||
expect {
|
||||
- val = "string"
|
||||
- }.to change { val.class }.from(Fixnum).to(NilClass)
|
||||
- }.to fail_with(/but is now String/)
|
||||
+ val = :symbol
|
||||
+ }.to change { val.class }.from(String).to(NilClass)
|
||||
+ }.to fail_with(/but is now Symbol/)
|
||||
end
|
||||
|
||||
context "with boolean values" do
|
||||
diff -Nur a/spec/rspec/matchers/match_array_spec.rb b/spec/rspec/matchers/match_array_spec.rb
|
||||
--- a/spec/rspec/matchers/match_array_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/matchers/match_array_spec.rb 2023-08-15 11:14:44.375257172 +0800
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
describe "should =~ array", :uses_should do
|
||||
it "passes a valid positive expectation" do
|
||||
- [1, 2].should =~ [2, 1]
|
||||
+ [1, 2].should match_array([2, 1])
|
||||
end
|
||||
|
||||
it "fails an invalid positive expectation" do
|
||||
expect {
|
||||
- [1, 2, 3].should =~ [2, 1]
|
||||
+ [1, 2, 3].should match_array([2, 1])
|
||||
}.to fail_with(/expected collection contained/)
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
array = [1, 2]
|
||||
def array.send; :sent; end
|
||||
|
||||
- array.should =~ array
|
||||
+ array.should match_array(array)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -52,7 +52,7 @@
|
||||
describe "should_not =~ [:with, :multiple, :args]", :uses_should do
|
||||
it "is not supported" do
|
||||
expect {
|
||||
- [1,2,3].should_not =~ [1,2,3]
|
||||
+ [1,2,3].should_not match_array([1,2,3])
|
||||
}.to fail_with(/Matcher does not support should_not/)
|
||||
end
|
||||
end
|
||||
@@ -186,7 +186,7 @@
|
||||
context "when using the `should =~` syntax", :uses_should do
|
||||
it 'fails with a clear message when given a hash' do
|
||||
expect {
|
||||
- {}.should =~ {}
|
||||
+ {}.should match_array({})
|
||||
}.to fail_with(/expected an array/)
|
||||
end
|
||||
end
|
||||
diff -Nur a/spec/rspec/matchers/yield_spec.rb b/spec/rspec/matchers/yield_spec.rb
|
||||
--- a/spec/rspec/matchers/yield_spec.rb 2023-08-15 10:43:28.776068504 +0800
|
||||
+++ b/spec/rspec/matchers/yield_spec.rb 2023-08-15 10:54:24.413572619 +0800
|
||||
@@ -397,18 +397,18 @@
|
||||
end
|
||||
end
|
||||
|
||||
- describe "expect {...}.to yield_with_args(String, Fixnum)" do
|
||||
+ describe "expect {...}.to yield_with_args(String, Integer)" do
|
||||
it "passes if the block yields objects of the given types" do
|
||||
- expect { |b| _yield_with_args("string", 15, &b) }.to yield_with_args(String, Fixnum)
|
||||
+ expect { |b| _yield_with_args("string", 15, &b) }.to yield_with_args(String, Integer)
|
||||
end
|
||||
|
||||
it "passes if the block yields the given types" do
|
||||
- expect { |b| _yield_with_args(String, Fixnum, &b) }.to yield_with_args(String, Fixnum)
|
||||
+ expect { |b| _yield_with_args(String, Integer, &b) }.to yield_with_args(String, Integer)
|
||||
end
|
||||
|
||||
it "fails if the block yields objects of different types" do
|
||||
expect {
|
||||
- expect { |b| _yield_with_args(15, "string", &b) }.to yield_with_args(String, Fixnum)
|
||||
+ expect { |b| _yield_with_args(15, "string", &b) }.to yield_with_args(String, Integer)
|
||||
}.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
|
||||
end
|
||||
end
|
||||
@@ -495,18 +495,18 @@
|
||||
end
|
||||
end
|
||||
|
||||
- describe "expect {...}.to yield_successive_args(String, Fixnum)" do
|
||||
+ describe "expect {...}.to yield_successive_args(String, Integer)" do
|
||||
it "passes if the block successively yields objects of the given types" do
|
||||
- expect { |b| ["string", 15].each(&b) }.to yield_successive_args(String, Fixnum)
|
||||
+ expect { |b| ["string", 15].each(&b) }.to yield_successive_args(String, Integer)
|
||||
end
|
||||
|
||||
it "passes if the block yields the given types" do
|
||||
- expect { |b| [String, Fixnum].each(&b) }.to yield_successive_args(String, Fixnum)
|
||||
+ expect { |b| [String, Integer].each(&b) }.to yield_successive_args(String, Integer)
|
||||
end
|
||||
|
||||
it "fails if the block yields objects of different types" do
|
||||
expect {
|
||||
- expect { |b| [15, "string"].each(&b) }.to yield_successive_args(String, Fixnum)
|
||||
+ expect { |b| [15, "string"].each(&b) }.to yield_successive_args(String, Integer)
|
||||
}.to fail_with(/expected given block to yield successively with arguments/)
|
||||
end
|
||||
end
|
||||
@ -9,7 +9,7 @@
|
||||
Summary: Rspec 2 expectations (should and matchers)
|
||||
Name: rubygem-%{rpmgem_name}
|
||||
Version: %{majorver}
|
||||
Release: 2
|
||||
Release: 3
|
||||
License: MIT
|
||||
URL: http://github.com/rspec/rspec-expectations
|
||||
Source0: https://rubygems.org/gems/%{gem_name}-%{fullver}.gem
|
||||
@ -18,6 +18,7 @@ Patch0: rubygem-rspec-expectations-2.14.5-be_truthy-alias.patch
|
||||
# Test suite fix for ruby24 wrt integer unification
|
||||
Patch1: rubygem-rspec-expectations-2.14.5-ruby24.patch
|
||||
Patch2: 0001-fix-NameError-compare-failure.patch
|
||||
Patch3: Fix-uninitialized-constant-and-method-ruby3.2.patch
|
||||
BuildRequires: ruby(release) rubygems-devel
|
||||
%if 0%{?need_bootstrap} < 1
|
||||
BuildRequires: rubygem(rspec2) %gem_minitest rubygem(test-unit)
|
||||
@ -42,6 +43,7 @@ gem unpack %{SOURCE0}
|
||||
%patch0 -p2
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
sed -i -e "s@\(require 'test/unit'\)@gem 'minitest', '~> 4' ;\1@" \
|
||||
spec/spec_helper.rb
|
||||
gem specification %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
||||
@ -78,6 +80,9 @@ popd
|
||||
%exclude %{gem_instdir}/spec/
|
||||
|
||||
%changelog
|
||||
* Tue Aug 15 2023 wulei <wu_lei@hoperun.com> - %{majorver}-3
|
||||
- Fix uninitialized constant and uninitialized method in ruby 3.2
|
||||
|
||||
* Tue Jan 17 2023 Ge Wang <wangge20@h-partners.com> - %{majorver}-2
|
||||
- fix NameError compare failure
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user