Sha256: 10719a4b7380d5c09ebb563c991a79ba2c64efbde9c0e1553f87562ea61b22c3

Contents?: true

Size: 453 Bytes

Versions: 4

Compression:

Stored size: 453 Bytes

Contents

module HtmlBeautifierTestUtilities

  def code(str)
    str = str.gsub(/\A\n|\n\s*\Z/, '')
    indentation = str[/\A +/]
    lines = str.split(/\n/)
    lines.map{ |line| line.sub(/^#{indentation}/, '') }.join("\n")
  end

  def assert_beautifies(expected, source)
    actual = ''
    beautifier = HtmlBeautifier::Beautifier.new(actual)
    beautifier.scan(source)
    assert expected == actual, "Expected:\n#{expected}\nbut was:\n#{actual}"
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
htmlbeautifier-0.0.6 test/html_beautifier_test_utilities.rb
htmlbeautifier-0.0.5 test/html_beautifier_test_utilities.rb
htmlbeautifier-0.0.4 test/html_beautifier_test_utilities.rb
htmlbeautifier-0.0.3 test/html_beautifier_test_utilities.rb