File: tilt_sasstemplate_test.rb

package info (click to toggle)
ruby-tilt 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 648 kB
  • sloc: ruby: 4,998; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 1,547 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require_relative 'test_helper'

checked_describe 'tilt/sass' do
  it "is registered for '.sass' files" do
    assert_equal Tilt::SassTemplate, Tilt['test.sass']
  end

  it "sets allows_script metadata set to false" do
    assert_equal false, Tilt::SassTemplate.new{''}.metadata[:allows_script]
  end

  it "compiles and evaluates the sass template on #render" do
    template = Tilt::SassTemplate.new({ style: :compressed }) { |t| "#main\n  background-color: #0000f1" }
    3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
  end

  it "compiles and evaluates the sass template on #render with unsupported options" do
    template = Tilt::SassTemplate.new({ style: :compressed, outvar: '@a' }) { |t| "#main\n  background-color: #0000f1" }
    3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
  end

  it "is registered for '.scss' files" do
    assert_equal Tilt::ScssTemplate, Tilt['test.scss']
  end

  it "compiles and evaluates the scss template on #render" do
    template = Tilt::ScssTemplate.new({ style: :compressed }) { |t| "#main {\n  background-color: #0000f1;\n}" }
    3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
  end

  it "compiles and evaluates the scss template on #render with unsupported options" do
    template = Tilt::ScssTemplate.new({ style: :compressed, outvar: '@a' }) { |t| "#main {\n  background-color: #0000f1;\n}" }
    3.times { assert_equal "#main{background-color:#0000f1}", template.render.chomp }
  end
end