Comments (6)
Just another example
In 3.4.1
irb(main):002> 100000.times.map.select { Faker::Internet.unique.email(name: Faker::Name.unique.name ).include?("..") }.count
=> 6754
In 3.3.1
irb(main):001> 100000.times.map.select { Faker::Internet.unique.email(name: Faker::Name.unique.name ).include?("..") }.count
=> 0
from faker.
def username(specifier: nil, separators: %w[. _]) with_locale(:en) do case specifier when ::String names = specifier&.gsub("'", '')&.split shuffled_names = shuffle(names) return shuffled_names.join(sample(separators)).downcase
I checked the code and it seems they are using '_' and '.' as default separators. They are splitting the string using spaces which will result in your case [" Msgr.", "Titus","Harvey"]. 'Msgr.' might have been concatinated to other word in the list using '.' as separator which leaded to the result in your case.
Try without including '.' in the name.
If developers want I can work on this to ignore '.'.
from faker.
Hi @Bertg, try generating with a name that doesn't have an abbreviated title and it should work as you would expect:
> Faker::Internet.unique.email(name: "Titus Harvey")
=> "[email protected]"
from faker.
@Bertg is my colleague and he is not showing the full example.
See below:
Faker::Internet.unique.email(name: Faker::Name.unique.name )
The problem is that in 3.3.1 the . was already being filtered out and all of a sudden in 3.4.1 it does not do that anymore. This is a serious regression from our view. Faker::Name.unique.name
is not under our control ...
from faker.
@thdaraujo Respectfully, that remark is a bit besides the point.
In the previous versions of Faker I could use any name I want in Faker::Internet.unique.email(name: some_name)
and a valid email would be returned. In the latest version, I can no longer as the Faker behaviour changed.
As my colleague pointed out this should be considered a regression. Clearly by only using Faker I can now generate a bunch of invalid email addresses, where before we could not.
from faker.
I see what you mean now. Please take a look at #2970 and check if it fixes the problem for you.
We can't guarantee that any of these emails will be valid though, but it should restore the previous behaviour.
By the way, you can also use the generator directly, without having to generate a name first:
Faker::Internet.unique.email
from faker.
Related Issues (20)
- Reproducing "Faker::Base#regexify does not work with non-capturing groups or + repeat operator" on v 3.2.1 HOT 2
- `Faker::Time.backward (.forward)` may generate time which is greater (less) than the current time HOT 4
- Fix flaky spec on `TestFakerFile#test_file_name` HOT 6
- Translation missing | en.faker.company.indian_gst_number HOT 6
- Consistent addresses HOT 3
- Drop support for Ruby 2.7 HOT 9
- Invalid GB phone number from `Faker::PhoneNumber.phone_number` HOT 3
- Fake Zip Codes HOT 6
- v3.2.3 correct? HOT 9
- Faker 3.3.0 generating invalid phone numbers HOT 8
- Invalid Timezone: Atlantic/Cabo_Verde HOT 1
- Random Test Failure: Faker::Omniauth tests fail when generating a name with an apostrophe HOT 8
- Add option to silence deprecation warnings when running the tests HOT 4
- Add id method to Faker::Internet module HOT 3
- CodeClimate maintainability badge is not working HOT 3
- Problems with Internet generator and FactoryBot HOT 3
- CH IBAN / QR-IBAN problem HOT 7
- I18n::MissingTranslationData: Translation missing: en.faker.company.buzzwords (I18n::MissingTranslationData) HOT 3
- NoMethodError (private method `rand' called for 0:Integer): HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faker.