mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove unneeded AV::Base and AV::Template monkey-patches
This commit is contained in:
parent
947f86c699
commit
6416a35f4b
3 changed files with 3 additions and 24 deletions
|
@ -1,4 +1,5 @@
|
|||
require "abstract_controller/base"
|
||||
require "action_view/base"
|
||||
|
||||
module AbstractController
|
||||
class DoubleRenderError < Error
|
||||
|
|
|
@ -2,27 +2,6 @@ require 'action_controller/test_case'
|
|||
require 'action_view'
|
||||
|
||||
module ActionView
|
||||
class Base
|
||||
alias_method :initialize_without_template_tracking, :initialize
|
||||
def initialize(*args)
|
||||
@_rendered = { :template => nil, :partials => Hash.new(0) }
|
||||
initialize_without_template_tracking(*args)
|
||||
end
|
||||
|
||||
attr_internal :rendered
|
||||
end
|
||||
|
||||
class Template
|
||||
alias_method :render_without_tracking, :render
|
||||
def render(view, locals, &blk)
|
||||
rendered = view.rendered
|
||||
rendered[:partials][self] += 1 if partial?
|
||||
rendered[:template] ||= []
|
||||
rendered[:template] << self
|
||||
render_without_tracking(view, locals, &blk)
|
||||
end
|
||||
end
|
||||
|
||||
class TestCase < ActiveSupport::TestCase
|
||||
class TestController < ActionController::Base
|
||||
attr_accessor :request, :response, :params
|
||||
|
|
|
@ -365,11 +365,10 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
|
|||
# check if we were rendered by a file-based template?
|
||||
def test_rendered_action
|
||||
process :nothing
|
||||
assert_nil @controller.template.rendered[:template]
|
||||
assert_template nil
|
||||
|
||||
process :hello_world
|
||||
assert @controller.template.rendered[:template]
|
||||
assert 'hello_world', @controller.template.rendered[:template].to_s
|
||||
assert_template 'hello_world'
|
||||
end
|
||||
|
||||
# check the redirection location
|
||||
|
|
Loading…
Reference in a new issue