summaryrefslogtreecommitdiff
path: root/spec/factories/product.rb
blob: fb64d0d6d12b312eee908b924f3d96e1e26b2257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

FactoryBot.define do
  factory :product, class: 'Product' do
    name { Faker::Commerce.product_name }
    unitary_price { rand(1.0..1000.0) }
    bulk_price { rand(1.0..1000.0) }
    available_quantity { rand(1..1000) }
    company { create(:company) }
    categories do
      c = []
      (1..rand(5)).each do
        c.push(Faker::Commerce.department(max: 1))
      end
      c
    end
  end
end