mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Make engine check more explicit
Not everything that responds to `routes` is a Rails engine - for example a Grape API endpoint will have a `routes` method but can't be used with `assert_recognizes` as it doesn't respond to `recognize_path_with_request`. Fixes #32312.
This commit is contained in:
parent
8881d84369
commit
9232ba7119
1 changed files with 9 additions and 6 deletions
|
@ -3,12 +3,15 @@
|
|||
module ActionDispatch
|
||||
module Routing
|
||||
class Endpoint # :nodoc:
|
||||
def dispatcher?; false; end
|
||||
def redirect?; false; end
|
||||
def engine?; rack_app.respond_to?(:routes); end
|
||||
def matches?(req); true; end
|
||||
def app; self; end
|
||||
def rack_app; app; end
|
||||
def dispatcher?; false; end
|
||||
def redirect?; false; end
|
||||
def matches?(req); true; end
|
||||
def app; self; end
|
||||
def rack_app; app; end
|
||||
|
||||
def engine?
|
||||
rack_app.is_a?(Class) && rack_app < Rails::Engine
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue