From 9ac9d1ea50413f32169f7c98edeadad11bc7d248 Mon Sep 17 00:00:00 2001 From: wvengen Date: Wed, 2 Oct 2013 16:32:01 +0200 Subject: [PATCH] add spec for foodcoops/foodsoft#179 --- spec/integration/balancing_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/integration/balancing_spec.rb b/spec/integration/balancing_spec.rb index 2bf860be..eba7973e 100644 --- a/spec/integration/balancing_spec.rb +++ b/spec/integration/balancing_spec.rb @@ -103,6 +103,23 @@ describe 'settling an order', :type => :feature do expect(GroupOrderArticle.exists?(goa1.id)).to be_false end + it 'keeps product when amount is set to zero' do + within("#order_article_#{oa.id}") do + click_link I18n.t('ui.edit') + end + within("#edit_order_article_#{oa.id}") do + fill_in :order_article_units_to_order, :with => 0 + find('input[type="submit"]').click + end + expect(page).to have_selector("#order_article_#{oa.id}") + # make sure it still works after reloading + visit new_finance_order_path(order_id: order.id) + expect(page).to have_selector("#order_article_#{oa.id}") + expect(OrderArticle.exists?(oa.id)).to be_true + oa.reload + expect(oa.units_to_order).to eq(0) + end + end end