diff options
Diffstat (limited to 'actionview/test/activerecord')
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 6c44cb9e6c..34655bfe23 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..25e05f6222 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 |