aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/activerecord
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/activerecord
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/activerecord')
-rw-r--r--actionview/test/activerecord/controller_runtime_test.rb8
-rw-r--r--actionview/test/activerecord/form_helper_activerecord_test.rb3
-rw-r--r--actionview/test/activerecord/polymorphic_routes_test.rb8
-rw-r--r--actionview/test/activerecord/relation_cache_test.rb1
-rw-r--r--actionview/test/activerecord/render_partial_with_record_identification_test.rb20
5 files changed, 39 insertions, 1 deletions
diff --git a/actionview/test/activerecord/controller_runtime_test.rb b/actionview/test/activerecord/controller_runtime_test.rb
index 42b171ea07..7cbd3aaf89 100644
--- a/actionview/test/activerecord/controller_runtime_test.rb
+++ b/actionview/test/activerecord/controller_runtime_test.rb
@@ -39,6 +39,14 @@ class ControllerRuntimeLogSubscriberTest < ActionController::TestCase
include ActiveSupport::LogSubscriber::TestHelper
tests LogSubscriberController
+ with_routes do
+ get :show, to: "#{LogSubscriberController.controller_path}#show"
+ get :zero, to: "#{LogSubscriberController.controller_path}#zero"
+ get :db_after_render, to: "#{LogSubscriberController.controller_path}#db_after_render"
+ get :redirect, to: "#{LogSubscriberController.controller_path}#redirect"
+ post :create, to: "#{LogSubscriberController.controller_path}#create"
+ end
+
def setup
@old_logger = ActionController::Base.logger
super
diff --git a/actionview/test/activerecord/form_helper_activerecord_test.rb b/actionview/test/activerecord/form_helper_activerecord_test.rb
index 1472ee8def..22626de6cb 100644
--- a/actionview/test/activerecord/form_helper_activerecord_test.rb
+++ b/actionview/test/activerecord/form_helper_activerecord_test.rb
@@ -23,9 +23,12 @@ class FormHelperActiveRecordTest < ActionView::TestCase
@developer.projects << @project
@developer.save
+ super
+ @controller.singleton_class.include Routes.url_helpers
end
def teardown
+ super
Project.delete(321)
Developer.delete(123)
end
diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb
index 4b931f793f..724129a7d9 100644
--- a/actionview/test/activerecord/polymorphic_routes_test.rb
+++ b/actionview/test/activerecord/polymorphic_routes_test.rb
@@ -62,10 +62,14 @@ module Weblog
end
class PolymorphicRoutesTest < ActionController::TestCase
- include SharedTestRoutes.url_helpers
+ Routes = ActionDispatch::Routing::RouteSet.new
+ Routes.draw { }
+ include Routes.url_helpers
+
default_url_options[:host] = "example.com"
def setup
+ super
@project = Project.new
@task = Task.new
@step = Step.new
@@ -763,9 +767,11 @@ class DirectRoutesTest < ActionView::TestCase
include Routes.url_helpers
def setup
+ super
@category = Category.new("1")
@collection = Collection.new("2")
@product = Product.new("3")
+ @controller.singleton_class.include Routes.url_helpers
end
def test_direct_routes
diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb
index 56e17e67a8..a6befc3ee5 100644
--- a/actionview/test/activerecord/relation_cache_test.rb
+++ b/actionview/test/activerecord/relation_cache_test.rb
@@ -6,6 +6,7 @@ class RelationCacheTest < ActionView::TestCase
tests ActionView::Helpers::CacheHelper
def setup
+ super
view_paths = ActionController::Base.view_paths
lookup_context = ActionView::LookupContext.new(view_paths, {}, ["test"])
@view_renderer = ActionView::Renderer.new(lookup_context)
diff --git a/actionview/test/activerecord/render_partial_with_record_identification_test.rb b/actionview/test/activerecord/render_partial_with_record_identification_test.rb
index 3a698fa42e..2bb3cfeb5b 100644
--- a/actionview/test/activerecord/render_partial_with_record_identification_test.rb
+++ b/actionview/test/activerecord/render_partial_with_record_identification_test.rb
@@ -3,6 +3,16 @@
require "active_record_unit"
class RenderPartialWithRecordIdentificationController < ActionController::Base
+ ROUTES = test_routes do
+ get :render_with_record_collection, to: "render_partial_with_record_identification#render_with_record_collection"
+ get :render_with_scope, to: "render_partial_with_record_identification#render_with_scope"
+ get :render_with_record, to: "render_partial_with_record_identification#render_with_record"
+ get :render_with_has_many_association, to: "render_partial_with_record_identification#render_with_has_many_association"
+ get :render_with_has_many_and_belongs_to_association, to: "render_partial_with_record_identification#render_with_has_many_and_belongs_to_association"
+ get :render_with_has_one_association, to: "render_partial_with_record_identification#render_with_has_one_association"
+ get :render_with_record_collection_and_spacer_template, to: "render_partial_with_record_identification#render_with_record_collection_and_spacer_template"
+ end
+
def render_with_has_many_and_belongs_to_association
@developer = Developer.find(1)
render partial: @developer.projects
@@ -89,6 +99,11 @@ end
module Fun
class NestedController < ActionController::Base
+ ROUTES = test_routes do
+ get :render_with_record_in_nested_controller, to: "fun/nested#render_with_record_in_nested_controller"
+ get :render_with_record_collection_in_nested_controller, to: "fun/nested#render_with_record_collection_in_nested_controller"
+ end
+
def render_with_record_in_nested_controller
render partial: Game.new("Pong")
end
@@ -100,6 +115,11 @@ module Fun
module Serious
class NestedDeeperController < ActionController::Base
+ ROUTES = test_routes do
+ get :render_with_record_in_deeper_nested_controller, to: "fun/serious/nested_deeper#render_with_record_in_deeper_nested_controller"
+ get :render_with_record_collection_in_deeper_nested_controller, to: "fun/serious/nested_deeper#render_with_record_collection_in_deeper_nested_controller"
+ end
+
def render_with_record_in_deeper_nested_controller
render partial: Game.new("Chess")
end