Given an order object in a webshop that normally updates its total price each time a booking (a product_order jointable object) is made, how would I make this happen in FactoryGirl.
I was simply thinking something like this, where order.sum_all_bookings does the updating of the order object:
FactoryGirl.define do
factory :booking do
product_name 'Honeyjar 400 ml'
product_quantity '1'
product_price '3,99'
order
after(:create) do |booking|
booking.order.sum_all_bookings
end
end
end
Unfortunately nothing changes in the order object.