1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/test/use_in_file_templates_test.rb
Blake Mizerany 1987e55049 New standard: use_in_file_templates uses @@ mytemplate for lookup
i.e.

no more:

  ## index

is now:

  @@ index

This is is to help confusion when using Haml and looks better in pastie ;)
2008-04-27 18:05:42 -07:00

48 lines
759 B
Ruby

require File.dirname(__FILE__) + '/helper'
context "Rendering in file templates" do
setup do
Sinatra.application = nil
use_in_file_templates!
end
specify "should set template" do
assert Sinatra.application.templates[:foo]
end
specify "should set layout" do
assert Sinatra.application.templates[:layout]
end
specify "should render without layout if specified" do
get '/' do
haml :foo, :layout => false
end
get_it '/'
assert_equal "this is foo\n", body
end
specify "should render with layout if specified" do
get '/' do
haml :foo
end
get_it '/'
assert_equal "X\nthis is foo\nX\n", body
end
end
__END__
@@ foo
this is foo
@@ layout
X
= yield
X