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
Search Repo:
sinatra / test / template_test.rb
100644 31 lines (19 sloc) 0.641 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
require File.dirname(__FILE__) + '/helper'
 
context "Templates (in general)" do
  
  specify "are read from files if Symbols" do
    
    get '/from_file' do
      @name = 'Alena'
      erb :foo, :views_directory => File.dirname(__FILE__) + "/views"
    end
    
    get_it '/from_file'
    
    body.should.equal 'You rock Alena!'
    
  end
  
  specify "use layout.ext by default if available" do
    
    get '/layout_from_file' do
      erb :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
    end
    
    get_it '/layout_from_file'
    should.be.ok
    body.should.equal "x This is foo! x \n"
    
  end
  
end