Skip to content

Commit

Permalink
Update 'prepare' regexp to allow hyphen
Browse files Browse the repository at this point in the history
Address failing specs
  • Loading branch information
Jac Bergenson committed May 26, 2020
1 parent acebadd commit 2fe184f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/helpers/char.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Char
def self.prepare(string)
result = romanize_cyrillic string
result = fix_umlauts result
result.gsub(/\W/, '').downcase
result.gsub(/[^\w-]/, '').downcase
end

def self.fix_umlauts(string)
Expand Down
6 changes: 3 additions & 3 deletions test/faker/default/test_faker_internet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ def test_password_without_special_chars
end

def test_domain_name_without_subdomain
assert @tester.domain_name.match(/\w+\.\w+/)
assert @tester.domain_name.match(/[\w-]+\.\w+/)
end

def test_domain_name_with_subdomain
assert @tester.domain_name(subdomain: true).match(/\w+\.\w+\.\w+/)
assert @tester.domain_name(subdomain: true).match(/[\w-]+\.[\w-]+\.\w+/)
end

def test_domain_name_with_subdomain_and_with_domain_option_given
Expand All @@ -167,7 +167,7 @@ def test_domain_name_with_subdomain_and_with_domain_option_given_with_domain_suf
end

def test_domain_word
assert @tester.domain_word.match(/^\w+$/)
assert @tester.domain_word.match(/^[\w-]+$/)
end

def test_domain_suffix
Expand Down
2 changes: 1 addition & 1 deletion test/test_uk_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_uk_commerce_methods

def test_uk_internet_methods
assert Faker::Internet.email.match(/.+@[^.].+\.\w+/)
assert Faker::Internet.domain_word.match(/^\w+$/)
assert Faker::Internet.domain_word.match(/^[\w-]+$/)
end

def test_uk_name_methods
Expand Down

0 comments on commit 2fe184f

Please sign in to comment.