PageRenderTime 51ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/bundle/ruby/1.9.1/gems/tilt-1.3.3/test/tilt_sasstemplate_test.rb

https://bitbucket.org/sqctest02/sample_app_3_1
Ruby | 41 lines | 33 code | 8 blank | 0 comment | 2 complexity | cacee194a8ec32c13db3ed4d2214ba7f MD5 | raw file
Possible License(s): GPL-2.0
  1. require 'contest'
  2. require 'tilt'
  3. begin
  4. require 'sass'
  5. class SassTemplateTest < Test::Unit::TestCase
  6. test "is registered for '.sass' files" do
  7. assert_equal Tilt::SassTemplate, Tilt['test.sass']
  8. end
  9. test "compiles and evaluates the template on #render" do
  10. template = Tilt::SassTemplate.new { |t| "#main\n :background-color #0000f1" }
  11. assert_equal "#main {\n background-color: #0000f1; }\n", template.render
  12. end
  13. test "can be rendered more than once" do
  14. template = Tilt::SassTemplate.new { |t| "#main\n :background-color #0000f1" }
  15. 3.times { assert_equal "#main {\n background-color: #0000f1; }\n", template.render }
  16. end
  17. end
  18. class ScssTemplateTest < Test::Unit::TestCase
  19. test "is registered for '.scss' files" do
  20. assert_equal Tilt::ScssTemplate, Tilt['test.scss']
  21. end
  22. test "compiles and evaluates the template on #render" do
  23. template = Tilt::ScssTemplate.new { |t| "#main {\n background-color: #0000f1;\n}" }
  24. assert_equal "#main {\n background-color: #0000f1; }\n", template.render
  25. end
  26. test "can be rendered more than once" do
  27. template = Tilt::ScssTemplate.new { |t| "#main {\n background-color: #0000f1;\n}" }
  28. 3.times { assert_equal "#main {\n background-color: #0000f1; }\n", template.render }
  29. end
  30. end
  31. rescue LoadError => boom
  32. warn "Tilt::SassTemplate (disabled)\n"
  33. end