Skip to content

Commit

Permalink
Add Ruby 3.4 support
Browse files Browse the repository at this point in the history
* Use a single quote instead of a backtick as an opening quote. [Feature #16495]
* Hash#inspect rendering have been changed. [Bug #20433]
  • Loading branch information
voxik committed Dec 5, 2024
1 parent 55054b1 commit e8dd7ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/shoulda/matchers/independent/delegate_method_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def subject_handles_nil_delegate_object?
false
rescue NoMethodError => e
if e.message =~
/undefined method `#{delegate_method}' for nil/
/undefined method [`']#{delegate_method}' for nil/
false
else
raise e
Expand All @@ -468,7 +468,7 @@ def subject_handles_private_delegation?
false
rescue NoMethodError => e
if e.message =~
/private method `#{delegating_method}' called for/
/private method [`']#{delegating_method}' called for/
true
else
raise e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
it 'states that it should delegate method to the right object with right argument' do
matcher = delegate_method(:method_name).to(:delegate).
with_arguments(:foo, bar: [1, 2])
message = 'delegate #method_name to the #delegate object passing arguments [:foo, {:bar=>[1, 2]}]'
message = "delegate #method_name to the #delegate object passing arguments [:foo, #{{:bar=>[1, 2]}.to_s}]"

expect(matcher.description).to eq message
end
Expand Down Expand Up @@ -138,7 +138,7 @@ def country
it 'states that it should delegate method to the right object with right argument' do
matcher = delegate_method(:method_name).to(:delegate).
with_arguments(:foo, bar: [1, 2])
message = 'delegate .method_name to the .delegate object passing arguments [:foo, {:bar=>[1, 2]}]'
message = "delegate .method_name to the .delegate object passing arguments [:foo, #{{:bar=>[1, 2]}.to_s}]"

expect(matcher.description).to eq message
end
Expand Down Expand Up @@ -294,7 +294,7 @@ def mailman
context 'negating the matcher' do
it 'rejects with the correct failure message' do
post_office = PostOffice.new
message = 'Expected PostOffice not to delegate #deliver_mail to the #mailman object passing arguments ["221B Baker St.", {:hastily=>true}], but it did.'
message = "Expected PostOffice not to delegate #deliver_mail to the #mailman object passing arguments [\"221B Baker St.\", #{{:hastily=>true}.to_s}], but it did."

expect {
expect(post_office).
Expand All @@ -315,7 +315,7 @@ def mailman
'',
'Method calls sent to PostOffice#mailman:',
'',
'1) deliver_mail("221B Baker St.", {:hastily=>true})',
"1) deliver_mail(\"221B Baker St.\", #{{:hastily=>true}.to_s})"
].join("\n")

expect {
Expand Down

0 comments on commit e8dd7ff

Please sign in to comment.