Return "test" as the controller_name in ActionView tests

before https://github.com/rails/rails/pull/40125 test names would be
set to "test" after this change controller_name was nil when using
ActionView::TestCase.

This returns ActionView::TestCase to previous behavior returning "test"
This commit is contained in:
Adam Hess 2021-06-04 08:01:28 -07:00
parent ed3612e6d4
commit e8156a2788
4 changed files with 8 additions and 2 deletions

View File

@ -9,7 +9,6 @@ class TestControllerWithExtraEtags < ActionController::Base
"test/hello_world.erb" => "Hello world!"
)]
def self.controller_name; "test"; end
def self.controller_path; "test"; end
etag { nil }

View File

@ -24,6 +24,10 @@ module ActionView
self.class.controller_path = path
end
def self.controller_name
"test"
end
def initialize
super
self.class.controller_path = ""

View File

@ -6,7 +6,6 @@ require "active_support/logger"
class CaptureController < ActionController::Base
self.view_paths = [ File.expand_path("../../fixtures/actionpack", __dir__) ]
def self.controller_name; "test"; end
def self.controller_path; "test"; end
def content_for

View File

@ -56,6 +56,10 @@ module ActionView
assert_same _view, view
end
test "returns controller_name" do
assert_equal "test", controller_name
end
test "retrieve non existing config values" do
assert_nil ActionView::Base.empty.config.something_odd
end