aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/url_helper_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2018-09-24 14:49:26 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2018-09-24 15:39:15 -0700
commit4f96e739c215331562c09cd215536c35a85508fd (patch)
tree22ab11502954a40ce72f51efdfbc2f206a189a09 /actionview/test/template/url_helper_test.rb
parent0a829f7db10263c5bf5f8b4ee04ea92a05ecdd39 (diff)
downloadrails-4f96e739c215331562c09cd215536c35a85508fd.tar.gz
rails-4f96e739c215331562c09cd215536c35a85508fd.tar.bz2
rails-4f96e739c215331562c09cd215536c35a85508fd.zip
Remove deprecated catch-all route in the AV tests
This commit removes a deprecated catch-all route in the AV tests. It defines and includes the necessary routes for each test such that we don't need the catch-all anymore. This also helps push us toward #33970
Diffstat (limited to 'actionview/test/template/url_helper_test.rb')
-rw-r--r--actionview/test/template/url_helper_test.rb44
1 files changed, 33 insertions, 11 deletions
diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb
index 9d91dbb72b..dd52b8b6a3 100644
--- a/actionview/test/template/url_helper_test.rb
+++ b/actionview/test/template/url_helper_test.rb
@@ -704,7 +704,7 @@ end
class UrlHelperControllerTest < ActionController::TestCase
class UrlHelperController < ActionController::Base
- test_routes do
+ ROUTES = test_routes do
get "url_helper_controller_test/url_helper/show/:id",
to: "url_helper_controller_test/url_helper#show",
as: :show
@@ -768,6 +768,11 @@ class UrlHelperControllerTest < ActionController::TestCase
helper_method :override_url_helper_path
end
+ def setup
+ super
+ @routes = UrlHelperController::ROUTES
+ end
+
tests UrlHelperController
def test_url_for_shows_only_path
@@ -828,7 +833,7 @@ class UrlHelperControllerTest < ActionController::TestCase
end
class TasksController < ActionController::Base
- test_routes do
+ ROUTES = test_routes do
resources :tasks
end
@@ -850,6 +855,11 @@ end
class LinkToUnlessCurrentWithControllerTest < ActionController::TestCase
tests TasksController
+ def setup
+ super
+ @routes = TasksController::ROUTES
+ end
+
def test_link_to_unless_current_to_current
get :index
assert_equal "tasks\ntasks", @response.body
@@ -882,7 +892,7 @@ class Session
end
class WorkshopsController < ActionController::Base
- test_routes do
+ ROUTES = test_routes do
resources :workshops do
resources :sessions
end
@@ -905,7 +915,7 @@ class WorkshopsController < ActionController::Base
end
class SessionsController < ActionController::Base
- test_routes do
+ ROUTES = test_routes do
resources :workshops do
resources :sessions
end
@@ -932,6 +942,11 @@ class SessionsController < ActionController::Base
end
class PolymorphicControllerTest < ActionController::TestCase
+ def setup
+ super
+ @routes = WorkshopsController::ROUTES
+ end
+
def test_new_resource
@controller = WorkshopsController.new
@@ -946,6 +961,20 @@ class PolymorphicControllerTest < ActionController::TestCase
assert_equal %{/workshops/1\n<a href="/workshops/1">Workshop</a>}, @response.body
end
+ def test_current_page_when_options_does_not_respond_to_to_hash
+ @controller = WorkshopsController.new
+
+ get :edit, params: { id: 1 }
+ assert_equal "false", @response.body
+ end
+end
+
+class PolymorphicSessionsControllerTest < ActionController::TestCase
+ def setup
+ super
+ @routes = SessionsController::ROUTES
+ end
+
def test_new_nested_resource
@controller = SessionsController.new
@@ -966,11 +995,4 @@ class PolymorphicControllerTest < ActionController::TestCase
get :edit, params: { workshop_id: 1, id: 1, format: "json" }
assert_equal %{/workshops/1/sessions/1.json\n<a href="/workshops/1/sessions/1.json">Session</a>}, @response.body
end
-
- def test_current_page_when_options_does_not_respond_to_to_hash
- @controller = WorkshopsController.new
-
- get :edit, params: { id: 1 }
- assert_equal "false", @response.body
- end
end