Skip to content

Commit

Permalink
Replaced order.shipping_method with order.shipments in models.order_s…
Browse files Browse the repository at this point in the history
…pec.

Fixed factory completed_order_with_fees used in order_spec and also in line_items_controller_spec and orders_controller_spec.
  • Loading branch information
luisramos0 committed Sep 9, 2018
1 parent a7da07d commit 5d79e7e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions spec/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,29 @@
end
end

factory :shipping_method_with_shipping_fee, parent: :shipping_method do
transient do
shipping_fee 3
end

calculator { build(:calculator_per_item, preferred_amount: shipping_fee) }
require_ship_address { false }
distributors { [:distributor] }
end

factory :shipment_with_shipping_fee, parent: :shipment do
after(:create) do |shipment|
shipment.add_shipping_method(create(:shipping_method_with_shipping_fee), true)
end
end

factory :completed_order_with_fees, parent: :order_with_totals_and_distribution do
transient do
shipping_fee 3
payment_fee 5
end

shipping_method do
shipping_calculator = build(:calculator_per_item, preferred_amount: shipping_fee)
create(:shipping_method, calculator: shipping_calculator, require_ship_address: false, distributors: [distributor])
end
shipments { [ create(:shipment_with_shipping_fee) ] }

after(:create) do |order, evaluator|
create(:line_item, order: order)
Expand Down

0 comments on commit 5d79e7e

Please sign in to comment.