From e8dd7ff8171fae514d80fcaca658bb2d41eda19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 5 Dec 2024 11:17:24 +0100 Subject: [PATCH] Add Ruby 3.4 support * Use a single quote instead of a backtick as an opening quote. [Feature #16495] * Hash#inspect rendering have been changed. [Bug #20433] --- .../matchers/independent/delegate_method_matcher.rb | 4 ++-- .../matchers/independent/delegate_method_matcher_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/shoulda/matchers/independent/delegate_method_matcher.rb b/lib/shoulda/matchers/independent/delegate_method_matcher.rb index 0bd21b37e..b13323a48 100644 --- a/lib/shoulda/matchers/independent/delegate_method_matcher.rb +++ b/lib/shoulda/matchers/independent/delegate_method_matcher.rb @@ -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 @@ -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 diff --git a/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb b/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb index 9d94125ff..21044dc86 100644 --- a/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb @@ -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 @@ -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 @@ -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). @@ -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 {