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