changed access to @template_cache to a reader.

This commit is contained in:
Nick Sutterer 2010-05-26 19:56:04 +08:00 committed by Ryan Tomayko
parent 5d4d140a45
commit a5ceae91e8
2 changed files with 7 additions and 2 deletions

View File

@ -355,7 +355,7 @@ module Sinatra
end
def compile_template(engine, data, options, views)
@template_cache.fetch engine, data, options do
template_cache.fetch engine, data, options do
template = Tilt[engine]
raise "Template engine not found: #{engine}" if template.nil?
@ -387,6 +387,7 @@ module Sinatra
include Templates
attr_accessor :app
attr_reader :template_cache
def initialize(app=nil)
@app = app
@ -406,7 +407,7 @@ module Sinatra
@request = Request.new(env)
@response = Response.new
@params = indifferent_params(@request.params)
@template_cache.clear if settings.reload_templates
template_cache.clear if settings.reload_templates
invoke { dispatch! }
invoke { error_block!(response.status) }

View File

@ -10,4 +10,8 @@ class SinatraTest < Test::Unit::TestCase
end
assert_same Sinatra::Base, app.superclass
end
it "responds to #template_cache" do
assert_kind_of Tilt::Cache, Sinatra::Base.new.template_cache
end
end