mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix error when setting stock for new product
This commit is contained in:
committed by
Andy Brett
parent
65f6f1febf
commit
fb769d37f9
@@ -112,6 +112,27 @@ feature '
|
||||
variant = product.variants.first
|
||||
expect(variant.on_demand).to be true
|
||||
end
|
||||
|
||||
scenario "creating product with empty unit value", js: true do
|
||||
login_as_admin_and_visit spree.admin_products_path
|
||||
|
||||
click_link 'New Product'
|
||||
|
||||
fill_in 'product_name', with: 'Hot Cakes'
|
||||
select 'New supplier', from: 'product_supplier_id'
|
||||
select "Weight (kg)", from: 'product_variant_unit_with_scale'
|
||||
select taxon.name, from: "product_primary_taxon_id"
|
||||
fill_in 'product_price', with: '1.99'
|
||||
fill_in 'product_on_hand', with: 0
|
||||
check 'product_on_demand'
|
||||
select 'Test Tax Category', from: 'product_tax_category_id'
|
||||
page.find("div[id^='taTextElement']").native.send_keys('In demand, and on_demand! The hottest cakes in town.')
|
||||
|
||||
click_button 'Create'
|
||||
|
||||
expect(current_path).to eq spree.admin_products_path
|
||||
expect(page).to have_content "Unit value can't be blank"
|
||||
end
|
||||
end
|
||||
|
||||
context "as an enterprise user" do
|
||||
|
||||
@@ -247,6 +247,10 @@ module Spree
|
||||
expect(build(:simple_product, taxons: [], primary_taxon: nil)).not_to be_valid
|
||||
end
|
||||
|
||||
it "requires a unit value" do
|
||||
expect(build(:simple_product, unit_value: nil)).not_to be_valid
|
||||
end
|
||||
|
||||
it "requires a supplier" do
|
||||
expect(build(:simple_product, supplier: nil)).not_to be_valid
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user