Forgery Gem, How to create Dictonaries and Forgeries

so this is really simple:

first generate the forgery folders:
./script/generate forgery

Then create a Forgery Class in the Rails Root /lib/forgeries/service_forgery.rb

# Generates random service
class ServiceForgery < Forgery
def self.service_name
dictionaries[:services].random
end
end

Then create a dictionary file with no extenstion in Rails Root/lib/dictionaries/services

simple text file with hard returns:
Women’s Cut & Blow Dry
Men’s Cut
Single Process
Body Waves
Half head highlight
Up Do
BangTrim
Bonjour

then you can call the forgery like so:
ServiceForgery.service_name

and in your blueprints.rb:

Service.blueprint do
name { ServiceForgery.name }
category
start_price
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: