mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
@@ -10,7 +10,7 @@ module Spree
|
||||
|
||||
default_scope -> { where(deleted_at: nil) }
|
||||
|
||||
has_many :shipments
|
||||
has_many :shipments, through: :shipping_rates
|
||||
has_many :shipping_method_categories
|
||||
has_many :shipping_categories, through: :shipping_method_categories
|
||||
has_many :shipping_rates, inverse_of: :shipping_method
|
||||
|
||||
@@ -176,5 +176,19 @@ module Spree
|
||||
expect(shipping_method.calculator.calculable).to eq(shipping_method)
|
||||
end
|
||||
end
|
||||
|
||||
# Regression test for Spree #4492
|
||||
context "#shipments" do
|
||||
let!(:shipping_method) { create(:shipping_method) }
|
||||
let!(:shipment) do
|
||||
shipment = create(:shipment)
|
||||
shipment.shipping_rates.create!(shipping_method: shipping_method)
|
||||
shipment
|
||||
end
|
||||
|
||||
it "can gather all the related shipments" do
|
||||
expect(shipping_method.shipments).to include(shipment)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user