public
Description: Easy and customizable generation of forged data.
Homepage: http://sevenwire.com
Clone URL: git://github.com/sevenwire/forgery.git
name age message
file MIT-LICENSE Wed Feb 06 14:36:51 -0800 2008 The plugin. [brandonarbini]
file README.markdown Tue Sep 30 09:52:23 -0700 2008 Further tweaking. [nate]
file Rakefile Sun Jun 01 11:13:48 -0700 2008 Refactoring and writing specs. [nate]
directory generators/ Thu Apr 03 18:19:30 -0700 2008 Adding rails support. [nate]
file init.rb Thu Apr 03 18:19:30 -0700 2008 Adding rails support. [nate]
file install.rb Sun Jun 01 11:13:48 -0700 2008 Refactoring and writing specs. [nate]
directory lib/ Thu Jul 24 04:52:29 -0700 2008 Adding full_name to name forgery. [brandonarbini]
directory spec/ Mon Jun 02 21:21:25 -0700 2008 Refining forgeries and getting better spec cove... [nate]
file uninstall.rb Sun Jun 01 11:13:48 -0700 2008 Refactoring and writing specs. [nate]
README.markdown

Forgery

The Problem: Making meaningful development data for your application.

The Solution: A fake data generator that does more than just lorem ipsum and random text (well, it does those too, but also does much more).

Forgery generates fake data from dictionaries, formats, and recipes. The plugin includes a generator providing directories to make your own forgeries.

Generator


./script/generate forgery

In a rails project this generator creates:

  • RAILS_ROOT/lib/forgery
  • RAILS_ROOT/lib/forgery/dictionaries
  • RAILS_ROOT/lib/forgery/extensions
  • RAILS_ROOT/lib/forgery/forgeries
  • RAILS_ROOT/lib/forgery/formats

You can then use these directories to write your own dictionaries, class extensions, forgeries, and formats.

Forgery will look first here for dictionaries and formats, so you can override the ones used in the plugin.

See the forgeries in the plugin for examples of how to write your own.

See which dictionaries each forgery uses to override them with your own.

Examples

Here I'll supply a few examples of how it works, in general. See each forgery for individual examples.


BasicForgery.password # => "wYMYvq"
BasicForgery.password :allow_special => true # => ";Qo^N[T"
BasicForgery.hex_color # => "#f4d841"

MonetaryForgery.money # => "8.21"
MonetaryForgery.formatted_money # => "$3.25"
MonetaryForgery.money :min => 100, :max => 1000 # => "848.97"

Notes

This is a work in progress. If you find bugs or have forgeries to contribute, we'll gladly take them and give credit.

Enjoy.

Nate Sutton (nate@sevenwire.com)