aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/assertions
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2016-12-29 21:10:30 +0100
committerGitHub <noreply@github.com>2016-12-29 21:10:30 +0100
commit8990f767f7e1134a0c62db792375c9150de8c274 (patch)
tree9b1c374757715214e77854584888a9ac2219631a /actionpack/lib/action_dispatch/testing/assertions
parent8c547838446a604d7bf4a93340767cfcb1bbe2ce (diff)
parentf28d073a394c0575dac5505e2c1c8cafc66034c4 (diff)
downloadrails-8990f767f7e1134a0c62db792375c9150de8c274.tar.gz
rails-8990f767f7e1134a0c62db792375c9150de8c274.tar.bz2
rails-8990f767f7e1134a0c62db792375c9150de8c274.zip
Merge pull request #27371 from yukideluxe/with-routing-api-only
fix with_routing test helper to make it work with api-only controllers
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/assertions')
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/routing.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
index 454dcb9307..37c1ca02b6 100644
--- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb
@@ -152,8 +152,11 @@ module ActionDispatch
_routes = @routes
@controller.singleton_class.include(_routes.url_helpers)
- @controller.view_context_class = Class.new(@controller.view_context_class) do
- include _routes.url_helpers
+
+ if @controller.respond_to? :view_context_class
+ @controller.view_context_class = Class.new(@controller.view_context_class) do
+ include _routes.url_helpers
+ end
end
end
yield @routes