Merge pull request #9138 from jibees/9137-order-shipping-methods-alphabetically

Split checkout: Order shipping methods by name
This commit is contained in:
Filipe
2022-05-05 12:41:12 +01:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -47,7 +47,7 @@ module CheckoutCallbacks
end
def load_shipping_methods
@shipping_methods = available_shipping_methods
@shipping_methods = available_shipping_methods.sort_by(&:name)
end
def redirect_to_shop?

View File

@@ -182,6 +182,11 @@ describe "As a consumer, I want to checkout my order", js: true do
expect(page).not_to have_content "Save as default shipping address"
end
it 'display shipping methods alphabetically' do
shipping_methods = page.all(:field, "shipping_method_id").map { |field| field.sibling("label") }.map(&:text)
expect(shipping_methods).to eq ["A Free Shipping with required address", "Free Shipping", "Local", "Shipping with Fee", "Z Free Shipping without required address"]
end
it_behaves_like "when I have an out of stock product in my cart"
end