mirror of
https://github.com/askn/faker.git
synced 2023-08-10 21:13:01 +03:00
Fix username rotating between only 4 fixed values
This commit is contained in:
parent
112bfd0ba0
commit
fa7f556864
@ -169,32 +169,32 @@ describe Faker::Internet do
|
||||
|
||||
it "should return deterministic results when seeded" do
|
||||
Faker.seed 123456
|
||||
Faker::Internet.email.should eq "faker_internet@deckowboyer.biz"
|
||||
Faker::Internet.email("Nancy").should eq "nancy@batz.org"
|
||||
Faker::Internet.free_email.should eq "internet.faker@hotmail.com"
|
||||
Faker::Internet.email.should eq "danyka.gleichner@fay.net"
|
||||
Faker::Internet.email("Nancy").should eq "nancy@barrows.name"
|
||||
Faker::Internet.free_email.should eq "dayne_brown@hotmail.com"
|
||||
Faker::Internet.free_email("Nancy").should eq "nancy@yahoo.com"
|
||||
Faker::Internet.safe_email.should eq "internet_faker@example.org"
|
||||
Faker::Internet.safe_email("Nancy").should eq "nancy@example.com"
|
||||
Faker::Internet.user_name.should eq "internet.faker"
|
||||
Faker::Internet.safe_email.should eq "cassie@example.net"
|
||||
Faker::Internet.safe_email("Nancy").should eq "nancy@example.org"
|
||||
Faker::Internet.user_name.should eq "eve_batz"
|
||||
Faker::Internet.user_name("Nancy").should eq "nancy"
|
||||
Faker::Internet.user_name("Nancy Johnson", [".", "_", "-"] of ::String).should eq "nancy-johnson"
|
||||
Faker::Internet.password.should eq "NuSjR9XpA"
|
||||
Faker::Internet.password(8).should eq "Tb7vMjXzD"
|
||||
Faker::Internet.password(10, 20).should eq "Xc0qFgOxMo"
|
||||
Faker::Internet.password(10, 20, true).should eq "J9GvT6LdLd7"
|
||||
Faker::Internet.password(10, 20, true, true).should eq "#*^!#&@%^iG"
|
||||
Faker::Internet.domain_name.should eq "hackett.net"
|
||||
Faker::Internet.domain_word.should eq "murphy"
|
||||
Faker::Internet.domain_suffix.should eq "co"
|
||||
Faker::Internet.ip_v4_address.should eq "38.54.91.207"
|
||||
Faker::Internet.ip_v6_address.should eq "f682:cc5a:cb38:94d3:7911:ff68:94df:f377"
|
||||
Faker::Internet.mac_address.should eq "00:d0:57:d9:d8:d5"
|
||||
Faker::Internet.mac_address("55:44:33").should eq "55:44:33:bc:fd:c8"
|
||||
Faker::Internet.url.should eq "http://vonruedenlind.name/faker_internet"
|
||||
Faker::Internet.url("example.com").should eq "http://example.com/internet_faker"
|
||||
Faker::Internet.password.should eq "P2AtB7Vm"
|
||||
Faker::Internet.password(8).should eq "XzKdXc0qG"
|
||||
Faker::Internet.password(10, 20).should eq "Vj9gVt6lDlQ"
|
||||
Faker::Internet.password(10, 20, true).should eq "7c2s0zXmQlT"
|
||||
Faker::Internet.password(10, 20, true, true).should eq "@6IpGuR8PvG"
|
||||
Faker::Internet.domain_name.should eq "beatty.io"
|
||||
Faker::Internet.domain_word.should eq "veum"
|
||||
Faker::Internet.domain_suffix.should eq "io"
|
||||
Faker::Internet.ip_v4_address.should eq "230.101.43.38"
|
||||
Faker::Internet.ip_v6_address.should eq "a970:ba8b:26b8:f682:cc5a:cb38:94d3:7911"
|
||||
Faker::Internet.mac_address.should eq "00:68:df:77:d0:57"
|
||||
Faker::Internet.mac_address("55:44:33").should eq "55:44:33:d9:d8:d5"
|
||||
Faker::Internet.url.should eq "http://raugottlieb.com/mia_hills"
|
||||
Faker::Internet.url("example.com").should eq "http://example.com/daron_nolan"
|
||||
Faker::Internet.url("example.com", "/foobar.html").should eq "http://example.com/foobar.html"
|
||||
Faker::Internet.slug.should eq "mollitia.nostrum"
|
||||
Faker::Internet.slug("foo bar").should eq "foo.bar"
|
||||
Faker::Internet.slug.should eq "doloribus_quidem"
|
||||
Faker::Internet.slug("foo bar").should eq "foo_bar"
|
||||
Faker::Internet.slug("foo bar", "-").should eq "foo-bar"
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ module Faker
|
||||
return result[0...specifier.max]
|
||||
end
|
||||
|
||||
return name.scan(/\w+/).shuffle(Faker.rng).map(&.[0]).join(separators.sample(Faker.rng)).downcase if name
|
||||
# return name.scan(/\w+/).shuffle(Faker.rng).map(&.[0]).join(separators.sample(Faker.rng)).downcase if name
|
||||
[
|
||||
->{ Name.first_name.gsub(/\W/, "").downcase },
|
||||
->{
|
||||
@ -132,7 +132,8 @@ module Faker
|
||||
|
||||
if special_chars
|
||||
chars = %w(! @ # $ % ^ & *)
|
||||
Faker.rng.rand(min_length).times do |i|
|
||||
number_of_substitutions = Faker.rng.rand(min_length - 1) + 1 # substitute at least one character
|
||||
number_of_substitutions.times do |i|
|
||||
temp = temp.sub({temp[i] => chars[Faker.rng.rand(chars.size)]})
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user