Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Faker::Internet.slug #1136

Merged
merged 3 commits into from
May 15, 2018
Merged

Modify Faker::Internet.slug #1136

merged 3 commits into from
May 15, 2018

Conversation

philduffen
Copy link
Contributor

Before: slug('Something Co., Ltd.','-')
=> "something-co.,-ltd."

After: slug('Something Co., Ltd.','-')
=> "something-co-ltd"

Before: slug('Something Co., Ltd.','-')
 => "something-co.,-ltd."

After: slug('Something Co., Ltd.','-')
 => "something-co-ltd"
@@ -161,7 +161,7 @@ def url(host = domain_name, path = "/#{user_name}", scheme = 'http')

def slug(words = nil, glue = nil)
glue ||= sample(%w[- _ .])
(words || Faker::Lorem::words(2).join(' ')).gsub(' ', glue).downcase
(words || Faker::Lorem::words(2).join(' ')).delete(',.').gsub(' ', glue).downcase
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philduffen Could you write/modify the tests to make sure your new changes are working properly?

@vbrazo vbrazo changed the title Modify Modify Faker::Internet.slug Modify Faker::Internet.slug May 14, 2018
@@ -217,6 +217,10 @@ def test_slug_with_content_arg
assert @tester.slug('Foo bAr baZ').match(/^foo(_|\.|\-)bar(_|\.|\-)baz$/)
end

def test_slug_with_unwanted_content_arg
assert @tester.slug('Foo.. bAr., baZ,,').match(/^foo(_|\.|\-)bar(_|\.|\-)baz$/)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specs/tests ❤️ 🖤 💚 💛

@vbrazo vbrazo merged commit 4482309 into faker-ruby:master May 15, 2018
@vbrazo vbrazo self-requested a review July 19, 2018 01:38
davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
* Modify Modify Faker::Internet.slug

Before: slug('Something Co., Ltd.','-')
 => "something-co.,-ltd."

After: slug('Something Co., Ltd.','-')
 => "something-co-ltd"

* Add test for unwanted slug content i.e. extraneous commas and full stops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants