Permalink
Newer
Older
100644 68 lines (49 sloc) 1.51 KB
1
require File.dirname(__FILE__) + '/helper'
2
3
context "Sass" do
4
5
setup do
6
Sinatra.application = nil
7
end
8
9
context "Templates (in general)" do
10
11
setup do
12
Sinatra.application = nil
13
end
14
15
specify "are read from files if Symbols" do
16
17
get '/from_file' do
18
sass :foo, :views_directory => File.dirname(__FILE__) + "/views"
19
end
20
21
get_it '/from_file'
22
should.be.ok
23
body.should.equal "#sass {\n background_color: #FFF; }\n"
24
25
end
26
27
specify "raise an error if template not found" do
28
get '/' do
29
sass :not_found
30
end
31
32
lambda { get_it '/' }.should.raise(Errno::ENOENT)
33
end
34
35
specify "ignore default layout file with .sass extension" do
36
get '/' do
37
sass :foo, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
38
end
39
40
get_it '/'
41
should.be.ok
42
body.should.equal "#sass {\n background_color: #FFF; }\n"
43
end
44
45
specify "ignore explicitly specified layout file" do
46
get '/' do
47
sass :foo, :layout => :layout, :views_directory => File.dirname(__FILE__) + "/views/layout_test"
48
end
49
50
get_it '/'
51
should.be.ok
52
body.should.equal "#sass {\n background_color: #FFF; }\n"
53
end
54
55
it "passes :sass option to the Sass engine" do
56
get '/' do
57
sass "#sass\n :background-color #FFF\n :color #000\n", :sass => {:style => :compact}
58
end
59
60
get_it '/'
61
should.be.ok
62
body.should.equal "#sass { background-color: #FFF; color: #000; }\n"
63
end
64