require 'helper' begin require('creole/template') rescue LoadError end class TestSlimEmbeddedEngines < TestSlim def test_render_with_haml source = %q{ p - text = 'haml' haml: - passed_from_haml = 'from haml' %b Hello from #{text.upcase}! Second Line! - if true = true = passed_from_haml } assert_html "
Hello from HAML!\nSecond Line!\ntrue\nfrom haml
", source end def test_render_with_erb source = %q{ p - text = 'before erb block' erb: Hello from <%= text.upcase %>! Second Line! <% if true %><%= true %><% end %> } assert_html "Hello from BEFORE ERB BLOCK!\nSecond Line!\ntrue
", source end def test_render_with_markdown source = %q{ markdown: #Header Hello from #{"Markdown!"} "Second Line!" } assert_html "Hello from Markdown!\n\"Second Line!\"
\n", source end def test_render_with_creole source = %q{ creole: = head1 == head2 } assert_html "before liquid block
", source end def test_render_with_scss source = %q{ scss: $color: #f00; body { color: $color; } } assert_html "", source end def test_disabled_embedded_engine source = %{ ruby: Embedded Ruby } assert_runtime_error 'Embedded engine ruby is disabled', source, :enable_engines => %w(javascript) source = %{ ruby: Embedded Ruby } assert_runtime_error 'Embedded engine ruby is disabled', source, :enable_engines => %w(javascript) source = %{ ruby: Embedded Ruby } assert_runtime_error 'Embedded engine ruby is disabled', source, :disable_engines => %w(ruby) end def test_enabled_embedded_engine source = %q{ javascript: $(function() {}); } assert_html '', source, :disable_engines => %w(ruby) source = %q{ javascript: $(function() {}); } assert_html '', source, :enable_engines => %w(javascript) end end