2014-12-04 19:50:02 +01:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: products
|
|
|
|
#
|
2014-12-04 20:32:31 +01:00
|
|
|
# id :integer not null, primary key
|
2015-03-19 16:22:55 +01:00
|
|
|
# name :string not null
|
2016-03-08 15:53:50 +01:00
|
|
|
# price_cents :integer default(0), not null
|
2015-02-09 17:06:24 +01:00
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
2015-03-19 16:22:55 +01:00
|
|
|
# avatar_file_name :string
|
|
|
|
# avatar_content_type :string
|
|
|
|
# avatar_file_size :integer
|
|
|
|
# avatar_updated_at :datetime
|
2016-03-08 15:53:50 +01:00
|
|
|
# category :integer default(0)
|
|
|
|
# stock :integer default(0), not null
|
2015-09-02 20:33:35 +02:00
|
|
|
# calories :integer
|
2016-03-08 15:53:50 +01:00
|
|
|
# deleted :boolean default(FALSE)
|
2014-12-04 19:50:02 +01:00
|
|
|
#
|
|
|
|
|
2015-09-02 20:33:35 +02:00
|
|
|
require 'faker'
|
|
|
|
require 'identicon'
|
2014-11-24 21:45:32 +01:00
|
|
|
|
2015-09-02 20:33:35 +02:00
|
|
|
FactoryGirl.define do
|
|
|
|
factory :product do
|
2015-09-17 14:05:33 +02:00
|
|
|
name { Faker::Name.name }
|
2015-09-18 16:49:41 +02:00
|
|
|
price_cents { 1 + rand(120) }
|
|
|
|
price { price_cents / 100.0 }
|
2015-09-17 14:05:33 +02:00
|
|
|
stock { 30 + rand(30) }
|
|
|
|
calories { rand 20 }
|
|
|
|
avatar { Identicon.data_url_for name }
|
2015-09-07 14:26:07 +02:00
|
|
|
|
|
|
|
factory :invalid_product do
|
|
|
|
name nil
|
|
|
|
end
|
2015-03-03 17:41:53 +01:00
|
|
|
end
|
2014-11-24 21:45:32 +01:00
|
|
|
end
|