mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Display only shipping method that are set as front end available
and update the tests as well
This commit is contained in:
@@ -46,7 +46,10 @@ module CheckoutCallbacks
|
||||
end
|
||||
|
||||
def load_shipping_methods
|
||||
@shipping_methods = Spree::ShippingMethod.for_distributor(@order.distributor).order(:name)
|
||||
@shipping_methods = Spree::ShippingMethod.
|
||||
for_distributor(@order.distributor).
|
||||
display_on_checkout.
|
||||
order(:name)
|
||||
end
|
||||
|
||||
def redirect_to_shop?
|
||||
|
||||
@@ -48,6 +48,9 @@ describe "As a consumer, I want to checkout my order", js: true do
|
||||
name: "Payment with Fee", description: "Payment with fee",
|
||||
calculator: Calculator::FlatRate.new(preferred_amount: 1.23))
|
||||
}
|
||||
let(:shipping_backoffice_only) {
|
||||
create(:shipping_method, require_ship_address: true, name: "Shipping Backoffice Only", display_on: "back_end")
|
||||
}
|
||||
|
||||
before do
|
||||
allow(Flipper).to receive(:enabled?).with(:split_checkout).and_return(true)
|
||||
@@ -291,7 +294,7 @@ describe "As a consumer, I want to checkout my order", js: true do
|
||||
|
||||
describe "pre-selecting a shipping method" do
|
||||
it "preselect a shipping method if only one is available" do
|
||||
order.distributor.update! shipping_methods: [free_shipping]
|
||||
order.distributor.update! shipping_methods: [free_shipping, shipping_backoffice_only]
|
||||
|
||||
visit checkout_step_path(:details)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user