diff --git a/CHANGELOG.md b/CHANGELOG.md index 08195c66b6..4a158dd677 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ * [#2250](https://github.com/ruby-grape/grape/pull/2250): Add deprecation warning for `UnsupportedGroupTypeError` and `MissingGroupTypeError` - [@ericproulx](https://github.com/ericproulx). * [#2256](https://github.com/ruby-grape/grape/pull/2256): Raise `Grape::Exceptions::MultipartPartLimitError` from Rack when too many files are uploaded - [@bschmeck](https://github.com/bschmeck). * [#2266](https://github.com/ruby-grape/grape/pull/2266): Fix code coverage - [@duffn](https://github.com/duffn). +* [#2284](https://github.com/ruby-grape/grape/pull/2284): Fix an unexpected backtick - [@zysend](https://github.com/zysend). * Your contribution here. ### 1.6.2 (2021/12/30) diff --git a/lib/grape/middleware/error.rb b/lib/grape/middleware/error.rb index 5a8ba3dafd..3e9d8c768e 100644 --- a/lib/grape/middleware/error.rb +++ b/lib/grape/middleware/error.rb @@ -121,7 +121,7 @@ def rescue_handler_for_any_class(klass) def run_rescue_handler(handler, error) if handler.instance_of?(Symbol) - raise NoMethodError, "undefined method `#{handler}'" unless respond_to?(handler) + raise NoMethodError, "undefined method '#{handler}'" unless respond_to?(handler) handler = public_method(handler) end diff --git a/spec/grape/api_spec.rb b/spec/grape/api_spec.rb index 283dc70a65..0c77fd6055 100644 --- a/spec/grape/api_spec.rb +++ b/spec/grape/api_spec.rb @@ -2291,7 +2291,7 @@ def rescue_no_method_error subject.rescue_from :all, with: :not_exist_method subject.get('/rescue_method') { raise StandardError } - expect { get '/rescue_method' }.to raise_error(NoMethodError, /^undefined method `not_exist_method'/) + expect { get '/rescue_method' }.to raise_error(NoMethodError, /^undefined method 'not_exist_method'/) end it 'correctly chooses exception handler if :all handler is specified' do