public
Fork of bmizerany/sinatra
Description: Classy web-development dressed in a DSL
Homepage: http://sinatrarb.com
Clone URL: git://github.com/JackDanger/sinatra.git
sinatra / test / use_in_file_templates_test.rb
100644 49 lines (34 sloc) 0.759 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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