mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Preserve max quantity when reloading shopfront
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Api::LineItemSerializer < ActiveModel::Serializer
|
||||
attributes :id, :quantity, :price
|
||||
attributes :id, :quantity, :max_quantity, :price
|
||||
|
||||
has_one :variant, serializer: Api::VariantSerializer
|
||||
end
|
||||
|
||||
@@ -187,7 +187,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
visit shop_path
|
||||
end
|
||||
|
||||
it "should save group buy data to the cart" do
|
||||
it "should save group buy data to the cart and display it on shopfront reload" do
|
||||
# -- Quantity
|
||||
fill_in "variants[#{variant.id}]", with: 6
|
||||
page.should have_in_cart product.name
|
||||
@@ -202,6 +202,11 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
|
||||
li = Spree::Order.order(:created_at).last.line_items.order(:created_at).last
|
||||
li.max_quantity.should == 7
|
||||
|
||||
# -- Reload
|
||||
visit shop_path
|
||||
page.should have_field "variants[#{variant.id}]", with: 6
|
||||
page.should have_field "variant_attributes[#{variant.id}][max_quantity]", with: 7
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user