diff --git a/lib/grape/middleware/error.rb b/lib/grape/middleware/error.rb index b798a19210..6e5304607b 100644 --- a/lib/grape/middleware/error.rb +++ b/lib/grape/middleware/error.rb @@ -125,7 +125,7 @@ def run_rescue_handler(handler, error, endpoint) elsif response.is_a?(Rack::Response) response else - run_rescue_handler(:default_rescue_handler, Grape::Exceptions::InvalidResponse.new, endpoint) + run_rescue_handler(method(:default_rescue_handler), Grape::Exceptions::InvalidResponse.new, endpoint) end end diff --git a/spec/grape/api_spec.rb b/spec/grape/api_spec.rb index 3ac2fe7454..4800a2639b 100644 --- a/spec/grape/api_spec.rb +++ b/spec/grape/api_spec.rb @@ -2196,8 +2196,6 @@ def foo it 'uses default_rescue_handler to handle invalid response from rescue_from' do subject.rescue_from(:all) { 'error' } subject.get('/') { raise } - - expect_any_instance_of(Grape::Middleware::Error).to receive(:default_rescue_handler).and_call_original get '/' expect(last_response).to be_server_error expect(last_response.body).to eql 'Invalid response'