Sha256: 50fe6d6d6c3d3fc6cc02587280257e9006887721a67c943118f67637cc854b2c

Contents?: true

Size: 936 Bytes

Versions: 4

Compression:

Stored size: 936 Bytes

Contents

require File.dirname(__FILE__) + '/helper'
require 'less'

class LessTest < Test::Unit::TestCase
  def less_app(&block)
    mock_app {
      set :views, File.dirname(__FILE__) + '/views'
      get '/', &block
    }
    get '/'
  end

  it 'renders inline Less strings' do
    less_app { less "@white_color: #fff; #main { background-color: @white_color }"}
    assert ok?
    assert_equal "#main { background-color: #ffffff; }\n", body
  end

  it 'renders .less files in views path' do
    less_app { less :hello }
    assert ok?
    assert_equal "#main { background-color: #ffffff; }\n", body
  end

  it 'ignores the layout option' do
    less_app { less :hello, :layout => :layout2 }
    assert ok?
    assert_equal "#main { background-color: #ffffff; }\n", body
  end

  it "raises error if template not found" do
    mock_app {
      get('/') { less :no_such_template }
    }
    assert_raise(Errno::ENOENT) { get('/') }
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sinatra-1.0/test/less_test.rb
sinatra-base-1.0 test/less_test.rb
sinatra-1.0 test/less_test.rb
sinatra-1.0.b test/less_test.rb