Sha256: 234c90b8177d41980ed6d33425ba074063fe0f0ea966b25ae9b47e10191c8b74

Contents?: true

Size: 1.51 KB

Versions: 19

Compression:

Stored size: 1.51 KB

Contents

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

    it "passes :sass option to the Sass engine" do
      get '/' do
        sass "#sass\n  :background-color #FFF\n  :color #000\n", :sass => {:style => :compact}
      end

      get_it '/'
      should.be.ok
      body.should.equal "#sass { background-color: #FFF; color: #000; }\n"
    end

  end

end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
sinatra-sinatra-0.9.1.3 compat/sass_test.rb
sinatra-sinatra-0.9.2 compat/sass_test.rb
sinatra-0.9.6 compat/sass_test.rb
sinatra-0.9.5 compat/sass_test.rb
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/sinatra-0.9.4/compat/sass_test.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/sass_test.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.10.17 vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.10.16 vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.10.15 vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
middleman-0.10.14 vendor/gems/gems/sinatra-0.9.4/compat/sass_test.rb
sinatra-0.9.4 compat/sass_test.rb
sinatra-0.9.2 compat/sass_test.rb