Skip to content

Commit

Permalink
Fix rubocop errors & add one more test for slugify 'ascii' mode (jeky…
Browse files Browse the repository at this point in the history
  • Loading branch information
parkr committed Sep 8, 2016
1 parent 9164973 commit c1e6f1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Metrics/ClassLength:
- !ruby/regexp /test\/.*.rb$/
Max: 300
Metrics/CyclomaticComplexity:
Max: 8
Max: 9
Metrics/LineLength:
Exclude:
- !ruby/regexp /features\/.*.rb/
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def slugify(string, mode: nil, cased: false)
# "._~!$&'()+,;=@" is human readable (not URI-escaped) in URL
# and is allowed in both extN and NTFS.
SLUGIFY_PRETTY_REGEXP
when 'ascii'
when "ascii"
# For web servers not being able to handle Unicode, the safe
# method is to ditch anything else but latin letters and numeric
# digits.
Expand Down
5 changes: 4 additions & 1 deletion test/test_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ class TestUtils < JekyllUnitTest
end

should "replace everything else but ASCII characters" do
assert_equal "the-config-yml-file", Utils.slugify("The _config.yml file?", mode: "ascii")
assert_equal "the-config-yml-file",
Utils.slugify("The _config.yml file?", :mode => "ascii")
assert_equal "f-rtive-glance",
Utils.slugify("fürtive glance!!!!", :mode => "ascii")
end

should "only replace whitespace if mode is raw" do
Expand Down

0 comments on commit c1e6f1f

Please sign in to comment.