2007-11-29 00:13:51 -05:00
|
|
|
require File.dirname(__FILE__) + '/helper'
|
|
|
|
|
2008-09-07 09:23:02 -04:00
|
|
|
context "Templates" do
|
2008-08-31 03:39:26 -04:00
|
|
|
|
2007-11-29 00:13:51 -05:00
|
|
|
specify "are read from files if Symbols" do
|
2008-08-31 03:39:26 -04:00
|
|
|
|
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
|
2008-08-31 03:39:26 -04:00
|
|
|
|
2007-11-29 00:13:51 -05:00
|
|
|
get_it '/from_file'
|
2008-08-31 03:39:26 -04:00
|
|
|
|
2007-11-29 00:13:51 -05:00
|
|
|
body.should.equal 'You rock Alena!'
|
2008-08-31 03:39:26 -04:00
|
|
|
|
2007-11-29 00:13:51 -05:00
|
|
|
end
|
2008-08-31 03:39:26 -04:00
|
|
|
|
2008-02-21 01:45:17 -05:00
|
|
|
specify "use layout.ext by default if available" do
|
2008-08-31 03:39:26 -04:00
|
|
|
|
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-08-31 03:39:26 -04:00
|
|
|
|
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-08-31 03:39:26 -04:00
|
|
|
|
2008-02-21 01:45:17 -05:00
|
|
|
end
|
2008-08-31 03:39:26 -04:00
|
|
|
|
2007-11-29 00:13:51 -05:00
|
|
|
end
|