summaryrefslogtreecommitdiff
path: root/spec/factories/product.rb
blob: 8f643a63d4f3537f789911f63b83ceb8252c8b90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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
    public_id { SecureRandom.hex(12) }
  end
end