From 42d259923f3e0743ca7c58fc6d242be32a7a0cc6 Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Wed, 21 Nov 2018 11:45:45 +0100 Subject: [PATCH] Fix checkout feature specs --- app/controllers/spree/orders_controller_decorator.rb | 2 +- config/locales/en.yml | 1 + spec/features/consumer/shopping/checkout_spec.rb | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/spree/orders_controller_decorator.rb b/app/controllers/spree/orders_controller_decorator.rb index 1ad8853bb073..af7c31aa4c94 100644 --- a/app/controllers/spree/orders_controller_decorator.rb +++ b/app/controllers/spree/orders_controller_decorator.rb @@ -28,7 +28,7 @@ def edit associate_user if @order.insufficient_stock_lines.present? - flash[:error] = t(:spree_inventory_error_flash_for_insufficient_quantity) + flash[:error] = t("spree.inventory_error_flash_for_insufficient_quantity") end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index ca07385b1d1a..a42e632466ea 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2659,6 +2659,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using my_account: "My account" date: "Date" time: "Time" + inventory_error_flash_for_insufficient_quantity: "An item in your cart has become unavailable" layouts: admin: header: diff --git a/spec/features/consumer/shopping/checkout_spec.rb b/spec/features/consumer/shopping/checkout_spec.rb index e4775cbdd348..49b7c26dab2c 100644 --- a/spec/features/consumer/shopping/checkout_spec.rb +++ b/spec/features/consumer/shopping/checkout_spec.rb @@ -14,7 +14,7 @@ let(:enterprise_fee) { create(:enterprise_fee, amount: 1.23, tax_category: product.tax_category) } let(:product) { create(:taxed_product, supplier: supplier, price: 10, zone: zone, tax_rate_amount: 0.1) } let(:variant) { product.variants.first } - let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor) } + let(:order) { create(:order, order_cycle: order_cycle, distributor: distributor, bill_address_id: nil, ship_address_id: nil) } before do Spree::Config.shipment_inc_vat = true @@ -47,6 +47,7 @@ describe "when I have an out of stock product in my cart" do before do + variant.on_demand = false variant.on_hand = 0 variant.save! end @@ -411,6 +412,7 @@ def fill_out_form end it "takes us to the cart page with an error when a product becomes out of stock just before we purchase", js: true do + variant.on_demand = false variant.on_hand = 0 variant.save! @@ -418,7 +420,7 @@ def fill_out_form page.should_not have_content "Your order has been processed successfully" page.should have_selector 'closing', text: "Your shopping cart" - page.should have_content "Out of Stock" + page.should have_content "Out Of Stock" end context "when we are charged a shipping fee" do