Fix non-english characters delete on tags (#2579)

This commit is contained in:
Bolarinwa Balogun 2019-04-29 17:33:14 -04:00 committed by Ben Halpern
parent 2ea6accec1
commit 5b0340351b
2 changed files with 5 additions and 1 deletions

View file

@ -13,7 +13,7 @@ module ActsAsTaggableOn
return [] if string.blank?
string.downcase.split(",").map do |t|
t.strip.delete(" ").gsub(/[^0-9a-z]/i, "")
t.strip.delete(" ").gsub(/[^[:alnum:]]/i, "")
end
end

View file

@ -25,6 +25,10 @@ RSpec.describe ActsAsTaggableOn::TagParser do
tags = ["w0rd", "app|3", "&!tes4@#$%^&*"]
expect(create_tag_parser(tags)).to eq(%w[w0rd app3 tes4])
end
it "allows non-english characters" do
tags = %w[Optimización Καλημέρα Français]
expect(create_tag_parser(tags)).to eq(%w[optimización καλημέρα français])
end
it "returns nothing if nothing is recieved" do
expect(create_tag_parser([])).to eq([])
end