-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests for use_in_file_templates! and a little refactoring
- Loading branch information
Blake Mizerany
committed
Mar 28, 2008
1 parent
e0c7f97
commit 5e85712
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 | ||
|