mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
c00a25ee41
* Adds test/helper.rb and moves mock_app and other code specific to testing the framework out of Sinatra::Test. * Do not require test/unit. The sinatra/test/unit, sinatra/test/spec, and sinatra/test/rspec files can be used to choose the framework. * Add Sinatra::TestHarness, which should act similar to the Rack::Session proposal here: http://gist.github.com/41270 * Update the README with information on using the different test frameworks.
36 lines
896 B
Ruby
36 lines
896 B
Ruby
require File.dirname(__FILE__) + '/helper'
|
|
|
|
describe "Sass Templates" do
|
|
def sass_app(&block)
|
|
mock_app {
|
|
set :views, File.dirname(__FILE__) + '/views'
|
|
get '/', &block
|
|
}
|
|
get '/'
|
|
end
|
|
|
|
it 'renders inline Sass strings' do
|
|
sass_app { sass "#sass\n :background-color #FFF\n" }
|
|
should.be.ok
|
|
body.should.equal "#sass {\n background-color: #FFF; }\n"
|
|
end
|
|
|
|
it 'renders .sass files in views path' do
|
|
sass_app { sass :hello }
|
|
should.be.ok
|
|
body.should.equal "#sass {\n background-color: #FFF; }\n"
|
|
end
|
|
|
|
it 'ignores the layout option' do
|
|
sass_app { sass :hello, :layout => :layout2 }
|
|
should.be.ok
|
|
body.should.equal "#sass {\n background-color: #FFF; }\n"
|
|
end
|
|
|
|
it "raises error if template not found" do
|
|
mock_app {
|
|
get('/') { sass :no_such_template }
|
|
}
|
|
lambda { get('/') }.should.raise(Errno::ENOENT)
|
|
end
|
|
end
|