Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Fix issues on Ruby 3.4.0-preview1 #1471

Merged
merged 4 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/rspec/expectations/block_snippet_extractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def target_method(*, &block)
@proc_object = block
end

def another_method(*)
def another_method(*, &_block)
end

before do
Expand Down
6 changes: 5 additions & 1 deletion spec/rspec/expectations/failure_aggregator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,11 @@ def fail_including
# Each Ruby version return a different exception complement.
# This method gets the current version and return the
# right complement.
if RSpec::Support::Ruby.mri? && RUBY_VERSION > "1.8.7"
if RSpec::Support::Ruby.mri? && RUBY_VERSION.to_f > 3.3
def exception_complement(block_levels)
":in 'block (#{block_levels} levels) in <module:Expectations>'"
end
elsif RSpec::Support::Ruby.mri? && RUBY_VERSION > "1.8.7"
def exception_complement(block_levels)
":in `block (#{block_levels} levels) in <module:Expectations>'"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/matchers/built_in/eq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module Matchers

it "provides message, expected and actual with encoding details on #failure_message when string encoding is different" do
matcher = eq('abc'.encode('UTF-16LE'))
matcher.matches?('abc'.force_encoding('ASCII-8BIT'))
matcher.matches?('abc'.dup.force_encoding('ASCII-8BIT'))
expect(matcher.failure_message).to eq "\nexpected: #<Encoding:UTF-16LE> \"abc\"\n got: #<Encoding:ASCII-8BIT> \"abc\"\n\n(compared using ==)\n"
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/matchers/built_in/eql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Matchers

it "provides message, expected and actual with encoding details on #failure_message when string encoding is different" do
matcher = eql('abc'.encode('UTF-16LE'))
matcher.matches?('abc'.force_encoding('ASCII-8BIT'))
matcher.matches?('abc'.dup.force_encoding('ASCII-8BIT'))
expect(matcher.failure_message).to eq "\nexpected: #<Encoding:UTF-16LE> \"abc\"\n got: #<Encoding:ASCII-8BIT> \"abc\"\n\n(compared using eql?)\n"
end

Expand Down
6 changes: 3 additions & 3 deletions spec/rspec/matchers/built_in/yield_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module YieldHelpers
# these helpers are prefixed with an underscore to prevent
# collisions with the matchers (some of which have the same names)
def _dont_yield
def _dont_yield(&_block)
end

def _yield_with_no_args
yield
end

def _yield_with_args(*args)
def _yield_with_args(*args, &_block)
yield(*args)
end
end
Expand Down Expand Up @@ -789,7 +789,7 @@ def invalid_block(&block)
%w[ food barn ].each do |eventual|
initial = ''
_yield_with_args(initial, &b)
initial << eventual
initial += eventual
end
}.not_to yield_successive_args(a_string_matching(/foo/), a_string_matching(/bar/))
end
Expand Down
Loading