mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove :cache => true on lookup templates initialization.
This commit is contained in:
parent
aa508c9baf
commit
01ab6f961b
7 changed files with 3 additions and 53 deletions
|
@ -61,7 +61,7 @@ module ActionView
|
||||||
def initialize(view_paths, details = {})
|
def initialize(view_paths, details = {})
|
||||||
@details, @details_key = { :handlers => default_handlers }, nil
|
@details, @details_key = { :handlers => default_handlers }, nil
|
||||||
@frozen_formats, @skip_default_locale = false, false
|
@frozen_formats, @skip_default_locale = false, false
|
||||||
@cache = details.key?(:cache) ? details.delete(:cache) : true
|
@cache = true
|
||||||
|
|
||||||
self.view_paths = view_paths
|
self.view_paths = view_paths
|
||||||
self.registered_detail_setters.each do |key, setter|
|
self.registered_detail_setters.each do |key, setter|
|
||||||
|
|
|
@ -46,7 +46,7 @@ module ActionView
|
||||||
with_fallbacks { find_template(options[:file], options[:prefix], false, keys) }
|
with_fallbacks { find_template(options[:file], options[:prefix], false, keys) }
|
||||||
elsif options.key?(:inline)
|
elsif options.key?(:inline)
|
||||||
handler = Template.handler_class_for_extension(options[:type] || "erb")
|
handler = Template.handler_class_for_extension(options[:type] || "erb")
|
||||||
Template::Inline.new(options[:inline], handler, :locals => keys)
|
Template.new(options[:inline], "inline template", handler, :locals => keys)
|
||||||
elsif options.key?(:template)
|
elsif options.key?(:template)
|
||||||
options[:template].respond_to?(:render) ?
|
options[:template].respond_to?(:render) ?
|
||||||
options[:template] : find_template(options[:template], options[:prefix], false, keys)
|
options[:template] : find_template(options[:template], options[:prefix], false, keys)
|
||||||
|
|
|
@ -93,7 +93,6 @@ module ActionView
|
||||||
autoload :Error
|
autoload :Error
|
||||||
autoload :Handler
|
autoload :Handler
|
||||||
autoload :Handlers
|
autoload :Handlers
|
||||||
autoload :Inline
|
|
||||||
autoload :Text
|
autoload :Text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -185,14 +184,6 @@ module ActionView
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash
|
|
||||||
identifier.hash
|
|
||||||
end
|
|
||||||
|
|
||||||
def eql?(other)
|
|
||||||
other.is_a?(Template) && other.identifier == identifier
|
|
||||||
end
|
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
@inspect ||=
|
@inspect ||=
|
||||||
if defined?(Rails.root)
|
if defined?(Rails.root)
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
require 'digest/md5'
|
|
||||||
|
|
||||||
module ActionView
|
|
||||||
class Template
|
|
||||||
class Inline < ::ActionView::Template
|
|
||||||
def initialize(source, handler, options={})
|
|
||||||
super(source, "inline template", handler, options)
|
|
||||||
end
|
|
||||||
|
|
||||||
def md5_source
|
|
||||||
@md5_source ||= Digest::MD5.hexdigest(source)
|
|
||||||
end
|
|
||||||
|
|
||||||
def eql?(other)
|
|
||||||
other.is_a?(Inline) && other.md5_source == md5_source
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -79,17 +79,8 @@ module RenderTemplate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestWithResolverCache < Rack::TestCase
|
class TestRenderOnce < Rack::TestCase
|
||||||
testing RenderTemplate::RenderOnceController
|
testing RenderTemplate::RenderOnceController
|
||||||
include Tests
|
include Tests
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestWithoutResolverCache < Rack::TestCase
|
|
||||||
testing RenderTemplate::RenderOnceController
|
|
||||||
include Tests
|
|
||||||
|
|
||||||
def setup
|
|
||||||
RenderTemplate::RenderOnceController::RESOLVER.stubs(:caching?).returns(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -180,10 +180,6 @@ class LookupContextTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
assert_not_equal template, old_template
|
assert_not_equal template, old_template
|
||||||
end
|
end
|
||||||
|
|
||||||
test "can have cache disabled on initialization" do
|
|
||||||
assert !ActionView::LookupContext.new(FIXTURE_LOAD_PATH, :cache => false).cache
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class LookupContextWithFalseCaching < ActiveSupport::TestCase
|
class LookupContextWithFalseCaching < ActiveSupport::TestCase
|
||||||
|
|
|
@ -151,14 +151,6 @@ class TestERBTemplate < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_inline_template_is_only_equal_if_source_match
|
|
||||||
inline1 = ActionView::Template::Inline.new("sample", ERBHandler)
|
|
||||||
inline2 = ActionView::Template::Inline.new("sample", ERBHandler)
|
|
||||||
inline3 = ActionView::Template::Inline.new("other", ERBHandler)
|
|
||||||
assert inline1.eql?(inline2)
|
|
||||||
assert !inline1.eql?(inline3)
|
|
||||||
end
|
|
||||||
|
|
||||||
if "ruby".encoding_aware?
|
if "ruby".encoding_aware?
|
||||||
def test_resulting_string_is_utf8
|
def test_resulting_string_is_utf8
|
||||||
@template = new_template
|
@template = new_template
|
||||||
|
|
Loading…
Reference in a new issue