1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Added sass_test.rb and supporting template/layout files.

This commit is contained in:
Nickolas Means 2008-04-08 19:51:20 -05:00
parent 95ca3f0c69
commit 41b7a3181e
4 changed files with 63 additions and 0 deletions

57
test/sass_test.rb Normal file
View file

@ -0,0 +1,57 @@
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

2
test/views/foo.sass Normal file
View file

@ -0,0 +1,2 @@
#sass
:background_color #FFF

View file

@ -0,0 +1,2 @@
#sass
:background_color #FFF

View file

@ -0,0 +1,2 @@
b0rked!
= yield