From 4a470193d2e90624491d96342e8fd68f12a4da4f Mon Sep 17 00:00:00 2001 From: bruno Date: Mon, 29 Jul 2024 11:53:29 -0300 Subject: [PATCH] corrections --- test/factories/gifts.rb | 2 +- test/factories/purchases.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/factories/gifts.rb b/test/factories/gifts.rb index 9110cb2..c770913 100644 --- a/test/factories/gifts.rb +++ b/test/factories/gifts.rb @@ -18,7 +18,7 @@ content_type: 'image/png' ) gift.supplier ||= create(:supplier) - gift.categories ||= create_list(:category, 3) + gift.categories = create_list(:category, 3) if gift.categories.empty? end trait(:with_customizations) do diff --git a/test/factories/purchases.rb b/test/factories/purchases.rb index 4d86be3..d3e16f4 100644 --- a/test/factories/purchases.rb +++ b/test/factories/purchases.rb @@ -12,8 +12,8 @@ purchase.destinations = build_list(:destination, 1, purchase: purchase) end - purchase.gift = create(:gift) if purchase.gift.nil? - purchase.payment_method = create(:payment_method) if purchase.payment_method.nil? + purchase.gift ||= create(:gift) + purchase.payment_method ||= create(:payment_method) purchase.subtotal = purchase.amount * purchase.gift_price purchase.price = purchase.subtotal + (purchase.subtotal * 0.22).to_i + 180 end