Skip to content
krainboltgreene edited this page Jul 21, 2011 · 2 revisions

boolean

Returns either true or false, randomly.

Forgery(:basic).boolean
  #=> true

Forgery(:basic).boolean
  #=> false

color

Randomly generates the name of a color, with the first character uppercase, as a string.

Forgery(:basic).color
  #=> "Violet"

Derives the list of colors from dictionaries[:colors].

encrypt

Creates a SHA1 hexdigest, with the current time as a salt. It takes two arguments:

  1. A string (default: "password")
  2. Any object, should be something that has a meaningful return to .to_s, (default: Time.now.to_s)
Forgery(:basic).encrypt
  #=> "b2fbd3955a36068e93e0b9db45bcb178f08336f5"

Forgery(:basic).encrypt 'random-string'
  #=> "00932bafce4a9391f888ca77f81f98b8e89d3aa6"

Forgery(:basic).encrypt 'random-string', Time.utc(2009) 
  #=> "4b157c2fbf430b962842d21926eaa887c3a12f81"

frequency

Lorem

hex_color

Lorem

number

Lorem

password

Lorem

short_hex_color

Lorem

text

Lorem

Clone this wiki locally