Add tests for mode parameters of slugify Liquid filter
This commit is contained in:
parent
46e76bde3f
commit
3c5e9f5334
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue