This gem is a port of Perl's Data::Faker library that generates fake data.
It comes in very handy for taking screenshots (taking screenshots for my project, Catch the Best was the original impetus for the creation of this gem), having real-looking test data, and having your database populated with more than one or two records while you're doing development.
sudo gem install faker
Faker::Name.name #=> "Christophe Bartell"
Faker::Internet.email #=> "[email protected]"
# random image from flickrs public feed api
Faker::Flickr.image("tag1,tag2") #=> "http://farm4.staticflickr.com/3777/11403511074_029f4b2234_b.jpg"
Since you may want to make addresses and other types of data look different depending on where in the world you are (US postal codes vs. UK postal codes, for example), Faker uses the I18n gem to store strings (like state names) and formats (US postal codes are NNNNN while UK postal codes are AAN NAA), allowing you to get different formats by switching locales. Just set Faker::Config.locale to the locale you want, and Faker will take care of the rest.
If you'd like to contribute code or formats/data for another locale, fork the project at github, make your changes, then send a pull request.
note
Run bundle install
and rake test
to confirm tests are passing.
Comments and feedback are welcome. Send an email to Benjamin Curtis via the google group.
This code is free to use under the terms of the MIT license.