diff --git a/test/test_filters.rb b/test/test_filters.rb index 35ea6f0b..a6be0800 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -221,6 +221,10 @@ class TestFilters < Test::Unit::TestCase should "return a slugified string" do assert_equal "q-bert-says", @filter.slugify(" Q*bert says @!#?@!") end + + should "return a slugified string with mode" do + assert_equal "q-bert-says-@!-@!", @filter.slugify(" Q*bert says @!#?@!", "pretty") + end end context "push filter" do diff --git a/test/test_utils.rb b/test/test_utils.rb index ddc8750e..fc2d9b5d 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -139,6 +139,26 @@ class TestUtils < Test::Unit::TestCase Utils.slugify(title) assert_equal "Quick-start guide", title end + + should "not change behaviour if mode is default" do + assert_equal "the-config-yml-file", Utils.slugify("The _config.yml file?", "default") + end + + should "not change behaviour if mode is nil" do + assert_equal "the-config-yml-file", Utils.slugify("The _config.yml file?", nil) + end + + should "not replace period and underscore if mode is pretty" do + assert_equal "the-_config.yml-file", Utils.slugify("The _config.yml file?", "pretty") + end + + should "only replace whitespace if mode is raw" do + assert_equal "the-_config.yml-file?", Utils.slugify("The _config.yml file?", "raw") + end + + should "return the given string if mode is none" do + assert_equal "the _config.yml file?", Utils.slugify("The _config.yml file?", "none") + end end end