mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
Fixed 5 out of 7 tests in orders_and_fulfillments_report_spec by providing target_shipment in test line_items Fixed 12 out of 44 broken tests in bulk_order_management_spec.rb by providing target_shipment in test line_items.” “The remaining 32 failing tests are now failing with the very common: undefined method on_hand= on Spree::Variant Improved 1 test in reports_spec.rb by providing target_shipment in test line_items. Test now fails with undefined method Spree::Order.shipping_method Fixed 9 tests in orders_controller_spec by providing target_shipment in test line_items Fixed 4 tests in packing_report_spec.rb by providing target_shipment in test line_items. Failing tests are now failing with undefined product.on_hand? method Fixed 8 tests in line_items_controller_spec by providing target_shipment in test line_items Fixed 1 test in update_billable_periods_spec by providing target_shipment in test line_items Fixed 4 tests in bulk_coop_report_spec by providing target_shipment in test line_items. The 2 failing tests are now failing with undefined product.on_hand? method Improved 1 test in line_items_controller_spec by providing target_shipment in test line_items. Test is still failing with an unexpected method call Fixed 1 test in order_and_distributor_report_spec by providing target_shipment in test line_items
36 lines
1.1 KiB
Ruby
36 lines
1.1 KiB
Ruby
require 'spec_helper'
|
|
|
|
module Spree
|
|
describe Spree::Api::LineItemsController, type: :controller do
|
|
render_views
|
|
|
|
before do
|
|
allow(controller).to receive(:spree_current_user) { current_api_user }
|
|
end
|
|
|
|
#test that when a line item is updated, an order's fees are updated too
|
|
context "as an admin user" do
|
|
sign_in_as_admin!
|
|
|
|
let(:order) { FactoryBot.create(:order, state: 'complete', completed_at: Time.zone.now) }
|
|
let(:line_item) { FactoryBot.create(:line_item_with_shipment, order: order,final_weight_volume: 500) }
|
|
|
|
context "as a line item is updated" do
|
|
before { allow(controller).to receive(:order) { order } }
|
|
|
|
it "update distribution charge on the order" do
|
|
line_item_params = {
|
|
order_id: order.number,
|
|
id: line_item.id,
|
|
line_item: { id: line_item.id, final_weight_volume: 520 },
|
|
format: :json
|
|
}
|
|
|
|
expect(order).to receive(:update_distribution_charge!)
|
|
spree_post :update, line_item_params
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|