1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/compat/template_test.rb

31 lines
594 B
Ruby
Raw Normal View History

2007-11-29 00:13:51 -05:00
require File.dirname(__FILE__) + '/helper'
context "Templates" do
2007-11-29 00:13:51 -05:00
specify "are read from files if Symbols" do
2007-11-29 00:13:51 -05:00
get '/from_file' do
@name = 'Alena'
2008-02-21 01:45:17 -05:00
erb :foo, :views_directory => File.dirname(__FILE__) + "/views"
2007-11-29 00:13:51 -05:00
end
2007-11-29 00:13:51 -05:00
get_it '/from_file'
2007-11-29 00:13:51 -05:00
body.should.equal 'You rock Alena!'
2007-11-29 00:13:51 -05:00
end
2008-02-21 01:45:17 -05:00
specify "use layout.ext by default if available" do
2008-02-21 01:45:17 -05:00
get '/layout_from_file' do
erb :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
end
2008-02-21 01:45:17 -05:00
get_it '/layout_from_file'
should.be.ok
body.should.equal "x This is foo! x \n"
2008-02-21 01:45:17 -05:00
end
2007-11-29 00:13:51 -05:00
end