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:
parent
ed3612e6d4
commit
e8156a2788
|
@ -9,7 +9,6 @@ class TestControllerWithExtraEtags < ActionController::Base
|
||||||
"test/hello_world.erb" => "Hello world!"
|
"test/hello_world.erb" => "Hello world!"
|
||||||
)]
|
)]
|
||||||
|
|
||||||
def self.controller_name; "test"; end
|
|
||||||
def self.controller_path; "test"; end
|
def self.controller_path; "test"; end
|
||||||
|
|
||||||
etag { nil }
|
etag { nil }
|
||||||
|
|
|
@ -24,6 +24,10 @@ module ActionView
|
||||||
self.class.controller_path = path
|
self.class.controller_path = path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.controller_name
|
||||||
|
"test"
|
||||||
|
end
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
self.class.controller_path = ""
|
self.class.controller_path = ""
|
||||||
|
|
|
@ -6,7 +6,6 @@ require "active_support/logger"
|
||||||
class CaptureController < ActionController::Base
|
class CaptureController < ActionController::Base
|
||||||
self.view_paths = [ File.expand_path("../../fixtures/actionpack", __dir__) ]
|
self.view_paths = [ File.expand_path("../../fixtures/actionpack", __dir__) ]
|
||||||
|
|
||||||
def self.controller_name; "test"; end
|
|
||||||
def self.controller_path; "test"; end
|
def self.controller_path; "test"; end
|
||||||
|
|
||||||
def content_for
|
def content_for
|
||||||
|
|
|
@ -56,6 +56,10 @@ module ActionView
|
||||||
assert_same _view, view
|
assert_same _view, view
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "returns controller_name" do
|
||||||
|
assert_equal "test", controller_name
|
||||||
|
end
|
||||||
|
|
||||||
test "retrieve non existing config values" do
|
test "retrieve non existing config values" do
|
||||||
assert_nil ActionView::Base.empty.config.something_odd
|
assert_nil ActionView::Base.empty.config.something_odd
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue