Sha256: aea43ddb1f23ea82c5bd08f6878353f053dda09da3230529e5bbd6d1c768595b

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TestFilters < Test::Unit::TestCase
  
  class JekyllFilter
    include Jekyll::Filters
  end
  
  def setup
    @filter = JekyllFilter.new
  end

  def test_textilize_with_simple_string
    assert_equal "<p>something <strong>really</strong> simple</p>", @filter.textilize("something *really* simple")
  end
  
  def test_identify_and_split_at_fold
    assert_equal "<p>something</p>", @filter.before_fold("<p>something</p><hr/><p>something else</p>")
  end

  def test_array_to_sentence_string_with_no_args
    assert_equal "", @filter.array_to_sentence_string([])
  end

  def test_array_to_sentence_string_with_one_arg
    assert_equal "1", @filter.array_to_sentence_string([1])
    assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
  end
  
  def test_array_to_sentence_string_with_two_args
    assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
    assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
  end
  
  def test_array_to_sentence_string_with_multiple_args
    assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
    assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
  end
  
  def test_xml_escape_with_ampersands
    assert_equal "AT&amp;T", @filter.xml_escape("AT&T")
    assert_equal "&lt;code&gt;command &amp;lt;filename&amp;gt;&lt;/code&gt;", @filter.xml_escape("<code>command &lt;filename&gt;</code>")
  end

  def test_strip_html_suffix
    assert_equal "/posts/zomg", @filter.strip_html_suffix("/posts/zomg.html")
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jsjohnst-jekyll-0.4.1.999.1 test/test_filters.rb
jsjohnst-jekyll-0.4.1.999.2 test/test_filters.rb
jsjohnst-jekyll-0.4.1.999.3 test/test_filters.rb
jsjohnst-jekyll-0.4.1.999.4 test/test_filters.rb
jsjohnst-jekyll-0.4.1.999.6 test/test_filters.rb