Sha256: e41190633861609352a241acafd97a0502e5d91f74c739dae71f3f1fce6302f6

Contents?: true

Size: 944 Bytes

Versions: 4

Compression:

Stored size: 944 Bytes

Contents

require 'test/spec'
require 'sinatra/base'
require 'sinatra/test'

describe "Sass Templates" do
  include Sinatra::Test

  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

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
adamwiggins-sinatra-0.8.9 test/sass_test.rb
bmizerany-sinatra-0.9.0 test/sass_test.rb
rtomayko-sinatra-0.8.9 test/sass_test.rb
rtomayko-sinatra-0.9.0 test/sass_test.rb