aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/action_pack_assertions_test.rb
diff options
context:
space:
mode:
authorJulia López <julialopez@gmail.com>2016-12-21 17:08:46 +0100
committerJulia López <julialopez@gmail.com>2016-12-29 20:46:30 +0100
commitf28d073a394c0575dac5505e2c1c8cafc66034c4 (patch)
tree9b1c374757715214e77854584888a9ac2219631a /actionpack/test/controller/action_pack_assertions_test.rb
parent8c547838446a604d7bf4a93340767cfcb1bbe2ce (diff)
downloadrails-f28d073a394c0575dac5505e2c1c8cafc66034c4.tar.gz
rails-f28d073a394c0575dac5505e2c1c8cafc66034c4.tar.bz2
rails-f28d073a394c0575dac5505e2c1c8cafc66034c4.zip
fix with_routing when testing api only controllers
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index b08f1f1707..9ab152fc5c 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -128,6 +128,16 @@ module Admin
end
end
+class ApiOnlyController < ActionController::API
+ def nothing
+ head :ok
+ end
+
+ def redirect_to_new_route
+ redirect_to new_route_url
+ end
+end
+
class ActionPackAssertionsControllerTest < ActionController::TestCase
def test_render_file_absolute_path
get :render_file_absolute_path
@@ -170,6 +180,20 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
end
end
+ def test_with_routing_works_with_api_only_controllers
+ @controller = ApiOnlyController.new
+
+ with_routing do |set|
+ set.draw do
+ get "new_route", to: "api_only#nothing"
+ get "redirect_to_new_route", to: "api_only#redirect_to_new_route"
+ end
+
+ process :redirect_to_new_route
+ assert_redirected_to "http://test.host/new_route"
+ end
+ end
+
def test_assert_redirect_to_named_route_failure
with_routing do |set|
set.draw do