Skip to content

Instantly share code, notes, and snippets.

@MarkBennett
Created November 30, 2010 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkBennett/722625 to your computer and use it in GitHub Desktop.
Save MarkBennett/722625 to your computer and use it in GitHub Desktop.
require 'machinist/active_record'
require 'sham'
require 'faker'
require 'litdistco_faker'
Sham.email { Faker::Internet.email }
SalesItem.blueprint do
custno { Faker.numerify("N######") }
salesmn { "" }
dealer { "" }
cshipno { Faker.numerify("N######") }
company { Faker::Company.name }
state { "ON" }
city { ["TORONTO","OTTAWA","MISSISSAUGA","ETOBICOKE"].rand }
zip { Faker.bothify("?#? #?#") }
invno { Faker.bothify(["#######", "N######"].rand) }
invdte { Date.civil(2010, rand(12)+1, rand(28)+1) }
isbn10 { Faker.numerify(["##########","##########"].rand) }
ucc_ean { Faker.numerify("#############") }
title { Faker::LitDistCo.title }
price { Faker::LitDistCo.price }
itemprice { Faker::LitDistCo.price }
disc { Faker::LitDistCo.discount }
qtyord { Faker::LitDistCo.quantity }
qtyshp { Faker::LitDistCo.quantity }
grosspri { Faker::LitDistCo.price }
bextpri { Faker::LitDistCo.price }
adjustment { Faker::LitDistCo.adjustment }
district {}
plinid { Faker::LitDistCo.plinid }
end
User.blueprint do
email
password { "password" }
password_confirmation { "password" }
end
SalesItemUpload.blueprint do
created_by
status_code { SalesItemUpload::PENDING }
status_message { "Status message" }
end
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)
require Rails.root.join("spec", "blueprints")
if Rails.env.development?
# Create sample sales items
10.times do |i|
SalesItem.make
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment