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