mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
closes #308 - Depricate use_in_file_templates! in favor of slurp_file_templates
This commit is contained in:
parent
7c253c2f80
commit
056bd7bb77
3 changed files with 7 additions and 7 deletions
|
@ -4,4 +4,4 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|||
require 'sinatra/base'
|
||||
require 'sinatra/main'
|
||||
|
||||
use_in_file_templates!
|
||||
slup_file_templates
|
||||
|
|
|
@ -722,7 +722,7 @@ module Sinatra
|
|||
|
||||
# Load embeded templates from the file; uses the caller's __FILE__
|
||||
# when no file is specified.
|
||||
def use_in_file_templates!(file=nil)
|
||||
def slup_file_templates(file=nil)
|
||||
file ||= caller_files.first
|
||||
|
||||
begin
|
||||
|
@ -1119,7 +1119,7 @@ module Sinatra
|
|||
delegate :get, :put, :post, :delete, :head, :template, :layout,
|
||||
:before, :after, :error, :not_found, :configure, :set, :mime_type,
|
||||
:enable, :disable, :use, :development?, :test?,
|
||||
:production?, :use_in_file_templates!, :helpers
|
||||
:production?, :slup_file_templates, :helpers
|
||||
end
|
||||
|
||||
# Create a new Sinatra application. The block is evaluated in the new app's
|
||||
|
|
|
@ -76,9 +76,9 @@ class TemplatesTest < Test::Unit::TestCase
|
|||
assert_equal "Layout 3!\nHello World!\n", body
|
||||
end
|
||||
|
||||
it 'loads templates from source file with use_in_file_templates!' do
|
||||
it 'loads templates from source file with slup_file_templates' do
|
||||
mock_app {
|
||||
use_in_file_templates!
|
||||
slup_file_templates
|
||||
}
|
||||
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
||||
assert_equal "X\n= yield\nX\n", @app.templates[:layout][0]
|
||||
|
@ -90,10 +90,10 @@ class TemplatesTest < Test::Unit::TestCase
|
|||
assert_equal "from another views directory\n", body
|
||||
end
|
||||
|
||||
test 'use_in_file_templates simply ignores IO errors' do
|
||||
test 'slup_file_templates simply ignores IO errors' do
|
||||
assert_nothing_raised {
|
||||
mock_app {
|
||||
use_in_file_templates!('/foo/bar')
|
||||
slup_file_templates('/foo/bar')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue