From 9fff7951621ef62952fe183fffce78f0dacd4d16 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Mon, 18 Mar 2019 17:04:42 +0000 Subject: [PATCH 1/2] Fix typo in en.yml in key new_shipping_category --- config/locales/en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 33e90029e8..6faad9b37e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2900,7 +2900,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using shipping_methods: "Shipping Methods" shipping_categories: "Shipping Categories" - new_shipping_category: "NEWEW Shipping Categories" + new_shipping_category: "New Shipping Category" back_to_shipping_categories: "Back To Shipping Categories" analytics_trackers: "Analytics Trackers" From 90a14d426b32a45e5f5dbb5f9769e56a3e24acc4 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Mon, 18 Mar 2019 16:18:04 +0000 Subject: [PATCH 2/2] Add spec to cover editing on_hand and on_demand values in the variants edit page --- spec/features/admin/variants_spec.rb | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/spec/features/admin/variants_spec.rb b/spec/features/admin/variants_spec.rb index d47f7dc6bf..d17924df78 100644 --- a/spec/features/admin/variants_spec.rb +++ b/spec/features/admin/variants_spec.rb @@ -58,6 +58,47 @@ feature %q{ v.unit_description.should == 'bar' end + describe "editing on hand and on demand values", js:true do + let(:product) { create(:simple_product) } + let(:variant) { product.variants.first } + + before do + login_to_admin_section + end + + it "allows changing the on_hand value" do + visit spree.edit_admin_product_variant_path(product, variant) + + page.should have_field "variant_on_hand", with: variant.on_hand + page.should have_unchecked_field "variant_on_demand" + + fill_in "variant_on_hand", with: "123" + click_button 'Update' + page.should have_content %Q(Variant "#{product.name}" has been successfully updated!) + end + + it "allows changing the on_demand value" do + visit spree.edit_admin_product_variant_path(product, variant) + check "variant_on_demand" + + # on_hand reflects the change in on_demand + page.should have_field "variant_on_hand", with: "Infinity", disabled: true + + click_button 'Update' + page.should have_content %Q(Variant "#{product.name}" has been successfully updated!) + end + + it "memorizes on_hand value previously entered if enabling and disabling on_demand" do + visit spree.edit_admin_product_variant_path(product, variant) + fill_in "variant_on_hand", with: "123" + check "variant_on_demand" + uncheck "variant_on_demand" + + # on_hand shows the memorized value, not the original DB value + page.should have_field "variant_on_hand", with: "123" + end + end + it "soft-deletes variants", js: true do p = create(:simple_product) v = create(:variant, product: p)