summaryrefslogtreecommitdiff
path: root/spec/factories/product.rb
blob: abdf4bca4ae2153e1bbea640dfcc1cbb764666af (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(1000.0) }
    bulk_price { rand(1000.0) }
    available_quantity { rand(1000) }
    company { create(:company) }
    categories do
      c = []
      (0..rand(5)).each do
        c.push(Faker::Commerce.department(max: 1))
      end
      c
    end
  end
end