mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Order shipping methods by name
+ create spec
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user