Sha256: 7acd0dd61fcb2b5f8aa2aa4e570df7e99d953d9367f6535ce4c71b31dda4958f

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

require 'helper'

class TestSlimHelpers < TestSlim
  class HtmlSafeString < String
    def html_safe?
      true
    end
  end

  def test_list_of
    source = %q{
== list_of([1, 2, 3]) do |i|
  = i
}

    assert_html "<li>1</li>\n<li>2</li>\n<li>3</li>", source, :helpers => true
  end

  def test_list_of_with_html_safe
    Object.send(:define_method, :html_safe?) { false }
    String.send(:define_method, :html_safe) { HtmlSafeString.new(self) }

    source = %q{
= list_of([1, 2, 3]) do |i|
  = i
}

    html = Slim::Template.new(:helpers => true, :use_html_safe => true) { source }.render(@env)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slim-0.7.0 test/slim/test_code_helpers.rb