Skip to content

Commit

Permalink
fix(ruby-grape#2236): Running rubocop and applying corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jcagarcia committed Nov 10, 2023
1 parent 805228c commit 27c26e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/grape/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions spec/grape/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 #<Class:0x[0-9a-fA-F]+> in `\/hey' endpoint/)
end.to raise_error(NoMethodError, %r{^undefined method `undefined_helper' for #<Class:0x[0-9a-fA-F]+> in `/hey' endpoint})
end
end

Expand All @@ -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 #<Object:0x[0-9a-fA-F]+>$/)
end.to raise_error(NoMethodError, /^undefined method `x' for #<Object:0x[0-9a-fA-F]+>$/)
end
end
end
Expand Down

0 comments on commit 27c26e9

Please sign in to comment.