Skip to content
Newer
Older
100644 42 lines (33 sloc) 1.47 KB
87a5e74 @mchung Added array_to_sentence_string filter
mchung authored Dec 30, 2008
1 require File.dirname(__FILE__) + '/helper'
2
a653054 @mojombo fix test_filters classname and add to manifest
mojombo authored Jan 2, 2009
3 class TestFilters < Test::Unit::TestCase
87a5e74 @mchung Added array_to_sentence_string filter
mchung authored Dec 30, 2008
4 class JekyllFilter
5 include Jekyll::Filters
6 end
7
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 5, 2009
8 context "filters" do
9 setup do
10 @filter = JekyllFilter.new
11 end
ee65dad @willcodeforfoo Add textilize filter for transforming input into HTML via RedCloth, s…
willcodeforfoo authored Feb 12, 2009
12
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
13 should "textilize with simple string" do
14 assert_equal "<p>something <strong>really</strong> simple</p>", @filter.textilize("something *really* simple")
15 end
87a5e74 @mchung Added array_to_sentence_string filter
mchung authored Dec 30, 2008
16
0e132bf @qrush Upgrading the rest of the tests to shoulda
qrush authored Mar 6, 2009
17 should "convert array to sentence string with no args" do
18 assert_equal "", @filter.array_to_sentence_string([])
19 end
20
21 should "convert array to sentence string with one arg" do
22 assert_equal "1", @filter.array_to_sentence_string([1])
23 assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
24 end
25
26 should "convert array to sentence string with two args" do
27 assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
28 assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
29 end
30
31 should "convert array to sentence string with multiple args" do
32 assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
33 assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
34 end
35
36 should "escape xml with ampersands" do
37 assert_equal "AT&amp;T", @filter.xml_escape("AT&T")
38 assert_equal "&lt;code&gt;command &amp;lt;filename&amp;gt;&lt;/code&gt;", @filter.xml_escape("<code>command &lt;filename&gt;</code>")
39 end
ea70d8a @ap add minimal tests for xml_escape filter
ap authored Jan 20, 2009
40 end
41 end
Something went wrong with that request. Please try again.