summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-03-16 21:53:23 -0600
committerHombreLaser <sebastian-440@live.com>2023-03-16 21:53:23 -0600
commit69153b46eee0fec67efa66f9b5f0499730a98829 (patch)
treef07d8de984911fcf6d684b06ae69516cc9aa2b43 /spec/factories
parentec60f7fb4be7213174f150318e418cdd8832a39b (diff)
Mejorado código de ProductsController
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/product.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/factories/product.rb b/spec/factories/product.rb
new file mode 100644
index 0000000..ab65cd0
--- /dev/null
+++ b/spec/factories/product.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+FactoryBot.define do
+ factory :company, class: 'Company' 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