rubygem-rspec2-expectations/Fix-uninitialized-constant-and-method-ruby3.2.patch

186 lines
7.5 KiB
Diff
Raw Normal View History

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