tap/spec/factories/orders.rb
2015-09-04 16:47:49 +02:00

25 lines
553 B
Ruby

# == Schema Information
#
# Table name: orders
#
# id :integer not null, primary key
# user_id :integer
# price_cents :integer
# created_at :datetime not null
# updated_at :datetime not null
# cancelled :boolean default("f")
#
require 'faker'
FactoryGirl.define do
factory :order do
user
transient do
products_count 1
end
before(:create) do |order, evaluator|
order.order_items << create_list(:order_item, evaluator.products_count, order: order)
end
end
end