From 27c26e953f1a4263fcea2cf6b57c9a6e88318164 Mon Sep 17 00:00:00 2001 From: Juan Carlos Garcia Date: Fri, 10 Nov 2023 10:06:54 +0100 Subject: [PATCH] fix(#2236): Running rubocop and applying corrections --- lib/grape/endpoint.rb | 8 ++++++-- spec/grape/endpoint_spec.rb | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/grape/endpoint.rb b/lib/grape/endpoint.rb index 04deef72aa..f50084270e 100644 --- a/lib/grape/endpoint.rb +++ b/lib/grape/endpoint.rb @@ -404,8 +404,12 @@ def options? env[Grape::Http::Headers::REQUEST_METHOD] == Grape::Http::Headers::OPTIONS end - def method_missing(name, *args) - raise NoMethodError.new("undefined method `#{name}' for #{self.class} in `#{self.route.origin}' endpoint") + def method_missing(name, *_args) + raise NoMethodError.new("undefined method `#{name}' for #{self.class} in `#{route.origin}' endpoint") + end + + def respond_to_missing?(method_name, include_private = false) + super end end end diff --git a/spec/grape/endpoint_spec.rb b/spec/grape/endpoint_spec.rb index 26f5af0fc5..5788bd9131 100644 --- a/spec/grape/endpoint_spec.rb +++ b/spec/grape/endpoint_spec.rb @@ -698,9 +698,9 @@ def app subject.get('/hey') do undefined_helper end - expect { + expect do get '/hey' - }.to raise_error(NoMethodError, /^undefined method `undefined_helper' for # in `\/hey' endpoint/) + end.to raise_error(NoMethodError, %r{^undefined method `undefined_helper' for # in `/hey' endpoint}) end end @@ -709,9 +709,9 @@ def app subject.get('/hey') do Object.new.x end - expect { + expect do get '/hey' - }.to raise_error(NoMethodError, /^undefined method `x' for #$/) + end.to raise_error(NoMethodError, /^undefined method `x' for #$/) end end end