Skip to content
forked from faker-ruby/faker

A library for generating fake data such as names, addresses, and phone numbers.

License

Notifications You must be signed in to change notification settings

Current-RMS/faker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Faker

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.

Fork Details

This is a fork of the faker gem created by stympy.

This fork has been created to update the GB locale file, use regional locale naming that matches the naming used in the rails-i18n gem (ie. en-GB rather than en-gb) and provide the following additional functionality:

(1) address related UK cities and counties:

  • Faker::Address.uk_city => "Cambridge"
  • Faker::Address.uk_county => "Cornwall"
  • Faker::Address.uk_city("Cheshire") => "Chester"
  • Faker::Address.uk_city("Chester") => "Cheshire"

(2) address uk_town calls standard city method to return randomly generated name

(3) company name based on locale file formats

(4) company title and department methods returning values based on locale file contents

(5) company categories method returning an array of upto 5 generic categories

(6) internet website, facebook, twitter & linkedin methods

(7) internet email address creation for user and domain name:

(8) phone number cell_phone method returning values based on locale file formats

Using the Fork

To use this fork add the following to your application gemfile:

gem 'faker', :git => "git://github.com/insphire/faker.git"

Usage

Usage with Rails

If you want to change your locale with Rails from the default of :en, change config/application.rb, setting config.i18n.locale to whatever locale you want. Change locale rather than default_locale (as suggested by the comments in that file) so that I18n's fallbacks will work properly and Faker can use the formats and data in en.yml (if there is no Faker localization for your locale). If you'd prefer to set default_locale rather than locale, then you'll also need to add config.i18n.fallbacks.defaults = [:en] to your configuration to make the fallbacks work for Faker.

Customization

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.

Contributing

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.

Contact

Comments and feedback are welcome. Send an email to Benjamin Curtis via the google group.

License

This code is free to use under the terms of the MIT license.

About

A library for generating fake data such as names, addresses, and phone numbers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 45.7%
  • Ruby 42.3%
  • HTML 7.9%
  • CSS 4.1%