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 / sass_test.rb
100644 58 lines (41 sloc) 1.283 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
50
51
52
53
54
55
56
57
58
require File.dirname(__FILE__) + '/helper'
 
context "Sass" do
 
  setup do
    Sinatra.application = nil
  end
  
  context "Templates (in general)" do
 
    setup do
      Sinatra.application = nil
    end
 
    specify "are read from files if Symbols" do
 
      get '/from_file' do
        sass :foo, :views_directory => File.dirname(__FILE__) + "/views"
      end
 
      get_it '/from_file'
      should.be.ok
      body.should.equal "#sass {\n background_color: #FFF; }\n"
 
    end
    
    specify "raise an error if template not found" do
      get '/' do
        sass :not_found
      end
 
      lambda { get_it '/' }.should.raise(Errno::ENOENT)
    end
    
    specify "ignore default layout file with .sass extension" do
      get '/' do
        sass :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
      end
      
      get_it '/'
      should.be.ok
      body.should.equal "#sass {\n background_color: #FFF; }\n"
    end
    
    specify "ignore explicitly specified layout file" do
      get '/' do
        sass :foo, :layout => :layout, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
      end
      
      get_it '/'
      should.be.ok
      body.should.equal "#sass {\n background_color: #FFF; }\n"
    end
    
  end
 
end