File tree 2 files changed +11
-0
lines changed
lib/action_dispatch/routing
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ def url_options
16
16
end
17
17
end
18
18
19
+ def respond_to? ( method , include_private = false )
20
+ super || routes . url_helpers . respond_to? ( method )
21
+ end
22
+
19
23
def method_missing ( method , *args )
20
24
if routes . url_helpers . respond_to? ( method )
21
25
self . class . class_eval <<-RUBY , __FILE__ , __LINE__ + 1
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ def self.routes
30
30
match "/url_to_application" , :to => "inside_engine_generating#url_to_application"
31
31
match "/polymorphic_path_for_engine" , :to => "inside_engine_generating#polymorphic_path_for_engine"
32
32
match "/conflicting_url" , :to => "inside_engine_generating#conflicting"
33
+ match "/foo" , :to => "never#invoked" , :as => :named_helper_that_should_be_invoked_only_in_respond_to_test
33
34
end
34
35
35
36
routes
@@ -152,6 +153,8 @@ def setup
152
153
RailsApplication . routes . default_url_options = { }
153
154
end
154
155
156
+ include BlogEngine . routes . mounted_helpers
157
+
155
158
# Inside Engine
156
159
test "[ENGINE] generating engine's url use SCRIPT_NAME from request" do
157
160
get "/pure-awesomeness/blog/posts/1"
@@ -219,6 +222,10 @@ def setup
219
222
end
220
223
221
224
# Inside any Object
225
+ test "[OBJECT] proxy route should override respond_to?() as expected" do
226
+ assert_respond_to blog_engine , :named_helper_that_should_be_invoked_only_in_respond_to_test_path
227
+ end
228
+
222
229
test "[OBJECT] generating engine's route includes prefix" do
223
230
assert_equal "/awesome/blog/posts/1" , engine_object . post_path ( :id => 1 )
224
231
end
You can’t perform that action at this time.
0 commit comments