Skip to content

Instantly share code, notes, and snippets.

@hieunguyentrung
Created July 28, 2019 13:06
Show Gist options
  • Save hieunguyentrung/4cdf673f1fb4a2f884fcba5607c2c10d to your computer and use it in GitHub Desktop.
Save hieunguyentrung/4cdf673f1fb4a2f884fcba5607c2c10d to your computer and use it in GitHub Desktop.
Usefuly faker commands
### Internet
# Optional argument name=nil
Faker::Internet.safe_email #=> "[email protected]"
# Optional arguments specifier=nil, separators=%w(. _)
Faker::Internet.username #=> "alexie"
# Optional arguments: min_length=8, max_length=16
Faker::Internet.password #=> "Vg5mSvY1UeRg7"
Faker::Internet.ip_v4_address #=> "24.29.18.175"
# Optional arguments: host=domain_name, path="/#{username}", scheme=scheme
Faker::Internet.url #=> "http://thiel.com/chauncey_simonis"
# Optional arguments: words=nil, glue=nil
Faker::Internet.slug #=> "pariatur_laudantium"
Faker::Internet.slug('foo bar') #=> "foo.bar"
Faker::Internet.slug('foo bar', '-') #=> "foo-bar"
# Optional argument: vendor=nil
Faker::Internet.user_agent #=> "Mozilla/5.0 (compatible; MSIE 9.0; AOL 9.7; AOLBuild 4343.19; Windows NT 6.1; WOW64; Trident/5.0; FunWebProducts)"
Faker::Internet.user_agent(:firefox) #=> "Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0"
Faker::Internet.uuid #=> "929ef6ef-b11f-38c9-111b-accd67a258b2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment